• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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    permissions:
16      contents: write
17    timeout-minutes: 30
18    steps:
19      - uses: actions/checkout@v3
20
21      - name: Get mdBook
22        run: |
23          export MDBOOK_VERSION="dtolnay"
24          export MDBOOK_TARBALL="mdbook-${MDBOOK_VERSION}-x86_64-unknown-linux-gnu.tar.gz"
25          export MDBOOK_URL="https://github.com/dtolnay/mdBook/releases/download/cxx/${MDBOOK_TARBALL}"
26          curl -Lf "${MDBOOK_URL}" | tar -xzC book
27          book/mdbook --version
28
29      - name: Build
30        run: book/build.sh
31
32      - name: Push to gh-pages
33        working-directory: book/build
34        run: |
35          REV=$(git rev-parse --short HEAD)
36          git init
37          git remote add upstream https://x-access-token:${{secrets.GITHUB_TOKEN}}@github.com/dtolnay/cxx
38          git config user.name "CXX"
39          git config user.email "dtolnay+cxx@gmail.com"
40          git add -A .
41          git commit -qm "Website @ ${{github.repository}}@${REV}"
42          git push -q upstream HEAD:refs/heads/gh-pages --force
43