40 lines
1.1 KiB
YAML
40 lines
1.1 KiB
YAML
name: Deploy
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
paths:
|
|
- book/**
|
|
- .github/workflows/site.yml
|
|
|
|
jobs:
|
|
deploy:
|
|
name: Deploy
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
|
|
- name: Get mdBook
|
|
run: |
|
|
export MDBOOK_VERSION="dtolnay"
|
|
export MDBOOK_TARBALL="mdbook-${MDBOOK_VERSION}-x86_64-unknown-linux-gnu.tar.gz"
|
|
export MDBOOK_URL="https://github.com/dtolnay/mdBook/releases/download/cxx/${MDBOOK_TARBALL}"
|
|
curl -Lf "${MDBOOK_URL}" | tar -xzC book
|
|
book/mdbook --version
|
|
|
|
- name: Build
|
|
run: book/build.sh
|
|
|
|
- name: Push to gh-pages
|
|
working-directory: book/build
|
|
run: |
|
|
REV=$(git rev-parse --short HEAD)
|
|
git init
|
|
git remote add upstream https://x-access-token:${{secrets.GITHUB_TOKEN}}@github.com/dtolnay/cxx
|
|
git config user.name "CXX"
|
|
git config user.email "dtolnay+cxx@gmail.com"
|
|
git add -A .
|
|
git commit -qm "Website @ ${{github.repository}}@${REV}"
|
|
git push -q upstream HEAD:refs/heads/gh-pages --force
|