New pattern: Hive Mind #409
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: Gitbook Generation | |
on: | |
push: | |
branches: | |
- "main" | |
- "book-*" | |
jobs: | |
gitbook-generation: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.head_ref }} | |
- uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: '2.6' | |
working-directory: 'book/scripts/' | |
bundler-cache: true | |
- name: Determine book language | |
run: | | |
[[ "$GITHUB_REF_NAME" =~ ^book-.*$ ]] && book_language=${GITHUB_REF_NAME:5:2} || book_language="en" | |
echo "BOOK_LANGUAGE=$book_language" >> $GITHUB_ENV | |
- name: Generate ToC | |
run: | | |
cd book/scripts/ | |
ruby generate_toc.rb $BOOK_LANGUAGE | |
echo "Generated book for: $BOOK_LANGUAGE" >> $GITHUB_STEP_SUMMARY | |
- name: Copy .gitbook.yml to root | |
run: | | |
cp book/$BOOK_LANGUAGE/.gitbook.yaml . | |
- name: Commit updated files for the book | |
uses: stefanzweifel/git-auto-commit-action@v4 | |
with: | |
commit_message: Writing updated files for the book |