updated_book #37
This file contains hidden or 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: DispachedDeployBook | |
| on: | |
| repository_dispatch: | |
| types: [updated_book] | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write # To push a branch | |
| pull-requests: write # To create a PR from that branch | |
| steps: | |
| - uses: actions/checkout@v3 | |
| with: | |
| fetch-depth: 0 | |
| - 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: Deploy GitHub Pages | |
| run: | | |
| echo "payload Foo '${{ github.event.client_payload.foo }}'" | |
| pwd | |
| ls | |
| git config --global user.name "Deploy book from CI into github page" | |
| git config --global user.email "" | |
| git clone https://github.com/HyperAST/HyperAST.git | |
| cd HyperAST/book | |
| mdbook build | |
| cd ../.. | |
| # Delete the ref to avoid keeping history. | |
| git update-ref -d refs/heads/master | |
| pwd | |
| ls | |
| rm -rf docs/book/* | |
| ls docs | |
| mv HyperAST/book/book/* docs/book/ | |
| rm -rf HyperAST | |
| rm -rf mdbook | |
| git add . | |
| git commit -m "Deploy $GITHUB_SHA to HyperAST.github.io" | |
| git push --force |