-
Notifications
You must be signed in to change notification settings - Fork 50
90 lines (87 loc) · 2.67 KB
/
docs.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
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