-
Notifications
You must be signed in to change notification settings - Fork 0
124 lines (117 loc) · 4.36 KB
/
circular_release.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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
# From: https://github.com/rkdarst/sphinx-actions-test/blob/master/.github/workflows/sphinx-build.yml
name: Collect_Build
on:
workflow_dispatch:
inputs:
# amount:
# description: 'Amount of projects to fetch. For production this should be 1000 or higher.'
# required: true
# type: number
# default: 1000
deploy:
description: 'Docs shall be deployed'
required: true
type: boolean
default: false
schedule:
# * is a special character in YAML so you have to quote this string
- cron: '0 6 * * 1' # Every Monday at 6
env:
DEFAULT_BRANCH: "main"
SPHINXOPTS: "-W --keep-going -T"
# ^-- If these SPHINXOPTS are enabled, then be strict about the builds and fail on any warnings
jobs:
build-and-deploy_docs:
name: Collect_and_Docs
runs-on: ubuntu-latest
permissions:
contents: write
id-token: 'write'
env:
ON_CI: True
GH_KEY: ${{ secrets.GITHUB_TOKEN }}
AWESOMESPHINX_NEEDS_FILE: "/../awesome.json"
AWESOMESPHINX_AMOUNT: 1000
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install Python
uses: actions/setup-python@v4
with:
python-version: '3.9'
- name: Install deps
run: |
pip install -r docs/requirements.txt
pip install -r scripts/requirements.txt
- name: Debugging information
run: |
echo "github.ref:" ${{github.ref}}
echo "github.event_name:" ${{github.event_name}}
echo "github.head_ref:" ${{github.head_ref}}
echo "github.base_ref:" ${{github.base_ref}}
set -x
git rev-parse --abbrev-ref HEAD
git branch
git branch -a
git remote -v
python -V
pip list --not-required
pip list
echo "ON_CI = $ON_CI"
# Google auth
- uses: 'google-github-actions/auth@v0'
with:
service_account: '${{secrets.SERVICE_ACCOUNT_EMAIL}}'
workload_identity_provider: 'projects/${{secrets.PROJECT_ID}}/locations/global/workloadIdentityPools/${{secrets.WI_POOL_NAME}}/providers/${{secrets.WI_PROVIDER_NAME}}'
# build
- name: Collect PyPI data
run: python scripts/pypi_json.py
- name: Collect GitHub data
id: gh_data_collect
run: python scripts/github_stats.py
- name: Create Sphinx-Needs file
run: python scripts/needs_json.py
- uses: ammaraskar/sphinx-problem-matcher@master
- name: Build Sphinx docs
run: |
cd docs
sphinx-build -a -E -b html . _build/html
- name: Archive docs
uses: actions/upload-artifact@v3
with:
name: awesomeSphinx docs
path: docs/_build/html
# the following steps are only done after pushing to main or merging a PR
# clone and set up the old gh-pages branch
- name: Clone old gh-pages
if: ${{ github.event_name == 'schedule' && github.ref_name == 'main' || github.event.inputs.deploy == 'true' }}
run: |
set -x
git fetch
( git branch gh-pages remotes/origin/gh-pages && git clone . --branch=gh-pages _gh-pages/ ) || mkdir _gh-pages
rm -rf _gh-pages/.git/
rm -rf _gh-pages/.doctrees
mkdir -p _gh-pages/
# if a push and default branch, copy build to _gh-pages/ as the "main"
# deployment.
- name: Copy docs build
if: ${{ github.event_name == 'schedule' && github.ref_name == 'main' || github.event.inputs.deploy == 'true' }}
run: |
set -x
rsync -a docs/_build/html/ _gh-pages/
# add the .nojekyll file
- name: nojekyll
if: ${{ github.event_name == 'schedule' && github.ref_name == 'main' || github.event.inputs.deploy == 'true' }}
run: |
touch _gh-pages/.nojekyll
# deploy
# https://github.com/peaceiris/actions-gh-pages
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
if: ${{ (github.event_name == 'schedule' && github.ref_name == 'main' || github.event.inputs.deploy == 'true') && steps.gh_data_collect.conclusion == 'success' }}
with:
publish_branch: gh-pages
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: _gh-pages/
force_orphan: true