This repository has been archived by the owner on Oct 10, 2024. It is now read-only.
Initialize project #4
Workflow file for this run
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: Book | |
on: | |
pull_request: | |
push: | |
branches: | |
- 'main' | |
jobs: | |
build: | |
name: Build book | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- run: make book | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: book | |
path: docs/book | |
retention-days: 1 | |
publish: | |
name: Publish book on GitHub Pages | |
runs-on: ubuntu-22.04 | |
needs: build | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
ref: gh-pages | |
# do not remove helm chart related files if present | |
- run: ls | grep -v -E "index.yaml|.*\.tgz" | xargs rm -rf | |
- uses: actions/download-artifact@v3 | |
with: | |
name: book | |
- run: git add . | |
- name: Check diff | |
run: | | |
diffs=$(git status -s) | |
if [ "$diffs" = "" ]; then | |
echo "NO_DIFF=1" >> $GITHUB_ENV | |
else | |
printf "%s\n" "$diffs" | |
fi | |
- name: Commit changes | |
if: env.NO_DIFF != '1' | |
run: | | |
git config --global user.name 'Cybozu Neco' | |
git config --global user.email '[email protected]' | |
git commit -m 'update' | |
- name: Push to gh-pages | |
if: github.ref == 'refs/heads/main' && env.NO_DIFF != '1' | |
run: git push origin gh-pages |