Skip to content

Merge pull request #699 from pitkley/fix-ci-runner #183

Merge pull request #699 from pitkley/fix-ci-runner

Merge pull request #699 from pitkley/fix-ci-runner #183

Workflow file for this run

name: GitHub Pages
on:
push:
branches:
- main
tags:
- '*'
jobs:
docs:
runs-on: ubuntu-latest
strategy:
max-parallel: 1
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Retrieve cache
uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-doc-${{ hashFiles('**/Cargo.lock') }}
- name: Checkout existing gh-pages branch
uses: actions/checkout@v2
with:
ref: gh-pages
path: gh-pages
- name: Get latest tag
id: tag
uses: jimschubert/query-tag-action@v1
with:
commit-ish: HEAD
- name: Get a pretty-printed version of the current branch or tag
id: branch-or-tag
run: |
REF="$(
git symbolic-ref -q --short HEAD \
|| git describe --tags --exact-match
)"
if [ -z "${REF}" ]; then
echo "No ref available" >&2
exit 1
fi
echo "::set-output name=value::${REF}"
- name: Identify if tag is a prerelease
id: tag-prerelease
run: |
if [[ "${{ steps.branch-or-tag.outputs.value }}" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "::set-output name=value::false"
else
echo "::set-output name=value::true"
fi
- name: Create/update symlink for `/latest` to latest tag
if: ${{ steps.tag-prerelease.outputs.value == 'false' }}
run: |
rm gh-pages/latest || :
ln -sf "${{ steps.tag.outputs.tag }}" gh-pages/latest
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- name: cargo doc
uses: actions-rs/cargo@v1
with:
command: doc
args: --no-deps
- name: Move generated docs to the correct location
run: |
rm -rf "gh-pages/${{ steps.branch-or-tag.outputs.value }}" || :
mv target/doc "gh-pages/${{ steps.branch-or-tag.outputs.value }}"
- name: Deploy documentation to GitHub pages
if: success()
working-directory: ./gh-pages
run: ../hack/deploy-github-pages.sh
env:
COMMIT_MESSAGE: "Deploy documentation for ${{ steps.branch-or-tag.outputs.value }} to GitHub pages"