update github actions #5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy | ||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
env: | ||
CI_COMMIT_MESSAGE: Continuous Integration Build Artifacts | ||
CI_COMMIT_AUTHOR: Continuous Integration | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Install latest mdbook | ||
run: | | ||
tag=$(curl 'https://api.github.com/repos/rust-lang/mdbook/releases/latest' | jq -r '.tag_name') | ||
url="https://github.com/rust-lang/mdbook/releases/download/${tag}/mdbook-${tag}-x86_64-unknown-linux-gnu.tar.gz" | ||
mkdir mdbook | ||
curl -sSL $url | tar -xz --directory=./mdbook | ||
echo `pwd`/mdbook >> $GITHUB_PATH | ||
- name: Build Book | ||
run: | | ||
cd src/powerjoular/ | ||
mdbook build | ||
cd ../joularjx/ | ||
mdbook build | ||
- name : Copy build book | ||
run: | | ||
cd src/powerjoular/book/ | ||
cp -rf ./* docs/powerjoular | ||
cd ../../.. | ||
cd src/joularjx/book/ | ||
cp -rf ./* docs/joularjx | ||
- name: GIT Commit Build Artifacts | ||
# Only run on main branch push (e.g. after pull request merge). | ||
if: github.event_name == 'push' | ||
run: | | ||
git config --global user.name "${{ env.CI_COMMIT_AUTHOR }}" | ||
git config --global user.email "[email protected]" | ||
git commit -a -m "${{ env.CI_COMMIT_MESSAGE }}" | ||
git push |