docs #391
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 | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
branches: | |
- '*' | |
schedule: | |
- cron: "0 8 * 1-12 1" # Every monday at 8 am | |
workflow_dispatch: | |
permissions: | |
# To allow the workflow to push to the origin, when actions/checkout is used. | |
contents: write | |
jobs: | |
pre_ci: | |
runs-on: 'ubuntu-latest' | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
# required for PRs | |
fetch-depth: 2 | |
- name: Get commit message | |
id: get_commit_message | |
run: | | |
if [[ '${{ github.event_name }}' == 'push' ]]; then | |
echo "commit_message=$(git log --format=%B -n 1 HEAD)" >> $GITHUB_OUTPUT | |
elif [[ '${{ github.event_name }}' == 'pull_request' ]]; then | |
echo "commit_message=$(git log --format=%B -n 1 HEAD^2)" >> $GITHUB_OUTPUT | |
fi | |
outputs: | |
commit_message: | |
echo "${{ steps.get_commit_message.outputs.commit_message }}" | |
build_docs: | |
name: Documentation | |
runs-on: 'ubuntu-latest' | |
needs: pre_ci | |
if: "contains(needs.pre_ci.outputs.commit_message, 'website_dev') || github.ref == 'refs/heads/master'" | |
timeout-minutes: 120 | |
defaults: | |
run: | |
shell: bash -l {0} | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: conda-incubator/setup-miniconda@v2 | |
with: | |
auto-activate-base: true | |
activate-environment: "" | |
miniconda-version: "latest" | |
- name: conda setup | |
run: | | |
conda install anaconda-project | |
anaconda-project prepare | |
- name: Build cache | |
run: | | |
anaconda-project run build_cache | |
git config user.name github-actions | |
git config user.email github-actions@github.com | |
mv ./doc/_static/cache ./tmp | |
git fetch origin cache | |
git checkout cache | |
mv ./tmp/* ./doc/_static/cache | |
git add -f ./doc/_static/cache | |
ls ./doc/_static/cache | |
git commit -m "adding cached badges" | |
git push -f origin HEAD:cache | |
- uses: actions/checkout@v3 | |
with: | |
clean: false | |
- name: Build website | |
run: | | |
git checkout -b deploy-tmp | |
git fetch origin cache # all cached badges are in this branch | |
git checkout origin/cache -- ./doc/_static/cache | |
anaconda-project run build_website | |
- name: git status | |
run: | | |
git status | |
git diff | |
- name: Deploy main | |
if: ${{ github.ref == 'refs/heads/master' }} | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
publish_dir: ./builtdocs | |
cname: pyviz.org | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
force_orphan: true |