1name: Deploy 2 3on: 4 push: 5 branches: 6 - master 7 paths: 8 - book/** 9 - .github/workflows/site.yml 10 11jobs: 12 deploy: 13 name: Deploy 14 runs-on: ubuntu-latest 15 steps: 16 - uses: actions/checkout@v2 17 18 - name: Get mdBook 19 run: | 20 export MDBOOK_VERSION="dtolnay" 21 export MDBOOK_TARBALL="mdbook-${MDBOOK_VERSION}-x86_64-unknown-linux-gnu.tar.gz" 22 export MDBOOK_URL="https://github.com/dtolnay/mdBook/releases/download/cxx/${MDBOOK_TARBALL}" 23 curl -Lf "${MDBOOK_URL}" | tar -xzC book 24 book/mdbook --version 25 26 - name: Build 27 run: book/build.sh 28 29 - name: Push to gh-pages 30 working-directory: book/build 31 run: | 32 REV=$(git rev-parse --short HEAD) 33 git init 34 git remote add upstream https://x-access-token:${{secrets.GITHUB_TOKEN}}@github.com/dtolnay/cxx 35 git config user.name "CXX" 36 git config user.email "dtolnay+cxx@gmail.com" 37 git add -A . 38 git commit -qm "Website @ ${{github.repository}}@${REV}" 39 git push -q upstream HEAD:refs/heads/gh-pages --force 40