Converted GB Camera sections 2.2.6 - 3.1.2 #640
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: Build and deploy an updated version of the website | |
on: | |
push: | |
paths-ignore: | |
- 'historical/**' | |
- 'mediawiki-exporter/**' | |
- 'README.md' | |
- 'LICENSE' | |
pull_request: | |
paths-ignore: | |
- 'historical/**' | |
- 'mediawiki-exporter/**' | |
- 'README.md' | |
- 'LICENSE' | |
schedule: | |
- cron: '42 16 1/7 * *' | |
env: | |
MDBOOK_LINKCHECK_VER: 0.7.6 | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout pandocs | |
uses: actions/checkout@v2 | |
with: | |
path: pandocs | |
- name: Install mdbook | |
uses: peaceiris/actions-mdbook@v1 | |
with: | |
mdbook-version: 0.4.21 | |
# FIXME: Keep this up to date | |
- name: Install mdbook-linkcheck | |
run: | # `-L` because GitHub performs a redirection | |
curl -L -o mdbook-linkcheck.zip "https://github.com/Michael-F-Bryan/mdbook-linkcheck/releases/download/v${MDBOOK_LINKCHECK_VER}/mdbook-linkcheck.x86_64-unknown-linux-gnu.zip" | |
unzip mdbook-linkcheck.zip mdbook-linkcheck | |
chmod +x mdbook-linkcheck | |
- name: Install Python dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install -r pandocs/requirements.txt | |
- name: Cache build dir | |
uses: actions/cache@v2 | |
with: | |
path: pandocs/target/ | |
key: ${{ runner.os }}-build-${{ hashFiles('pandocs/Cargo.lock') }} | |
restore-keys: | | |
${{ runner.os }}-build- | |
- name: Build | |
working-directory: pandocs/ | |
env: | |
MDBOOK_BUILD__CREATE_MISSING: "false" # Prevent creating missing files in SUMMARY.md | |
MDBOOK_OUTPUT__LINKCHECK__COMMAND: "../mdbook-linkcheck" | |
run: | | |
mdbook build | |
- name: Store final build | |
uses: actions/upload-artifact@v2 | |
with: | |
name: Build output | |
path: pandocs/docs/pandocs/ | |
if-no-files-found: error | |
deploy: | |
runs-on: ubuntu-latest | |
needs: build | |
# Do not run this unless *pushing* to `master` | |
if: github.event_name == 'push' && github.ref == 'refs/heads/master' | |
steps: | |
- name: Checkout pandocs/gh-pages | |
uses: actions/checkout@v2 | |
with: | |
path: pandocs | |
ref: gh-pages | |
- name: Delete all current files | |
run: | | |
rm -vrf pandocs/* | |
- name: Unpack build | |
uses: actions/download-artifact@v2 | |
with: | |
name: Build output | |
path: pandocs/ | |
- name: Deploy | |
working-directory: pandocs/ | |
run: | | |
git config --local user.name "GitHub Action" | |
git config --global user.email "community@gbdev.io" | |
git remote -v | |
git branch -v | |
git add -A | |
git commit -am 'Update build' | |
git push -v |