docs #307
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: | |
jobs: | |
pre_ci: | |
runs-on: 'ubuntu-latest' | |
steps: | |
- uses: actions/checkout@v3 | |
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} | |
env: | |
DESC: "Documentation build" | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
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: | | |
eval "$(conda shell.bash hook)" | |
conda install anaconda-project | |
anaconda-project prepare | |
- name: Build cache | |
run: | | |
eval "$(conda shell.bash hook)" | |
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 "https://github.com/$GITHUB_REPOSITORY.git" cache:refs/remotes/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 "https://pyviz-developers:$GITHUB_TOKEN@github.com/$GITHUB_REPOSITORY.git" HEAD:cache | |
- uses: actions/checkout@v3 | |
with: | |
clean: false | |
- name: Build website | |
run: | | |
eval "$(conda shell.bash hook)" | |
git checkout -b deploy-tmp | |
git fetch "https://github.com/$GITHUB_REPOSITORY.git" cache:refs/remotes/cache # all cached badges are in this branch | |
git checkout cache -- ./doc/_static/cache | |
anaconda-project run build_website | |
- name: git status | |
run: | | |
git status | |
git diff | |
- name: Deploy dev | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
publish_dir: ./builtdocs | |
external_repository: pyviz-dev/website | |
personal_token: ${{ secrets.DEV_ACCESS_TOKEN }} | |
force_orphan: true | |
- 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 |