Fix version comment for softprops/actions-gh-release #739
Workflow file for this run
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: Docs CI | |
on: | |
push: | |
pull_request: | |
jobs: | |
docs: | |
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.repository | |
runs-on: ubuntu-latest | |
steps: | |
- name: Avoid git conflicts when tag and branch pushed at same time | |
if: startsWith(github.ref, 'refs/tags') | |
run: sleep 60 | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
# Need this to get version number from last tag | |
fetch-depth: 0 | |
- name: Install system packages | |
run: sudo apt-get install pandoc | |
- name: Install python packages | |
uses: ./.github/actions/install_requirements | |
with: | |
python_version: "3.9" | |
requirements_file: requirements-dev-3.x.txt | |
install_options: -e .[docs] | |
- name: Cache tutorial dataset | |
id: cache-tutorial-dataset | |
uses: actions/cache@v3 | |
with: | |
path: /tmp/I22 Tutorial Dataset/ | |
key: tutorial-dataset | |
- name: Download tutorial dataset | |
if: steps.cache-tutorial-dataset.outputs.cache-hit != 'true' | |
run: | | |
wget https://zenodo.org/record/2671750/files/I22%20Tutorial%20Dataset.zip -O /tmp/i22_dataset.zip | |
unzip /tmp/i22_dataset.zip -d /tmp/ | |
- name: Build docs | |
run: tox -e docs | |
- name: Sanitize ref name for docs version | |
run: echo "DOCS_VERSION=${GITHUB_REF_NAME//[^A-Za-z0-9._-]/_}" >> $GITHUB_ENV | |
- name: Move to versioned directory | |
run: mv build/html .github/pages/$DOCS_VERSION | |
- name: Write switcher.json | |
run: python .github/pages/make_switcher.py --add $DOCS_VERSION ${{ github.repository }} .github/pages/switcher.json | |
- name: Publish Docs to gh-pages | |
if: github.event_name == 'push' && github.actor != 'dependabot[bot]' | |
# We pin to the SHA, not the tag, for security reasons. | |
# https://docs.github.com/en/actions/learn-github-actions/security-hardening-for-github-actions#using-third-party-actions | |
uses: peaceiris/actions-gh-pages@373f7f263a76c20808c831209c920827a82a2847 # v3.9.3 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: .github/pages | |
keep_files: true |