github action updates (#903) #159
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: ActivitySim Branch Docs | |
# This workflow is provided as a service for forks to build branch-specific documentation. | |
on: | |
- push | |
- workflow_dispatch | |
jobs: | |
docbuild: | |
if: "contains(github.event.head_commit.message, '[makedocs]') && (github.repository_owner != 'ActivitySim') && (github.ref_name != 'develop')" | |
# develop branch docs are built at the end of the core test workflow, regardless of repository owner or commit message flags | |
name: ubuntu-latest py3.10 | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
shell: bash -l {0} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # get all tags, lets setuptools_scm do its thing | |
- name: Setup Mambaforge | |
uses: conda-incubator/setup-miniconda@v2 | |
with: | |
miniforge-variant: Mambaforge | |
miniforge-version: latest | |
use-mamba: true | |
python-version: "3.10" | |
activate-environment: docbuild | |
auto-activate-base: false | |
auto-update-conda: false | |
- name: Set cache date for year and month | |
run: echo "DATE=$(date +'%Y%m')" >> $GITHUB_ENV | |
- uses: actions/cache@v3 | |
with: | |
path: /usr/share/miniconda3/envs/docbuild | |
key: linux-64-conda-${{ hashFiles('conda-environments/docbuild.yml') }}-${{ env.DATE }}-${{ env.CACHE_NUMBER }} | |
id: cache | |
- name: Update environment | |
run: mamba env update --verbose -n docbuild -f conda-environments/docbuild.yml | |
if: steps.cache.outputs.cache-hit != 'true' | |
- name: Install activitysim | |
run: | | |
python -m pip install . | |
- name: Conda checkup | |
run: | | |
conda info -a | |
conda list | |
echo REPOSITORY ${{ github.repository }} | |
echo REF ${{ github.ref }} | |
echo REF_NAME ${{ github.ref_name }} | |
- name: Build the docs | |
run: | | |
cd docs | |
make clean | |
make html | |
- name: Push to GitHub Pages | |
uses: peaceiris/[email protected] | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
# Token is created automatically by Github Actions, no other config needed | |
publish_dir: ./docs/_build/html | |
destination_dir: ${{ github.ref_name }} |