forked from cleanlab/cleanlab
-
Notifications
You must be signed in to change notification settings - Fork 0
198 lines (167 loc) · 7.02 KB
/
gh-pages.yaml
File metadata and controls
198 lines (167 loc) · 7.02 KB
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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
name: GitHub Pages
on:
push:
branches:
- "**"
release:
types: [published]
workflow_dispatch:
jobs:
deploy:
runs-on: ubuntu-20.04
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install Pandoc
# pin Pandoc version
run: |
cd /tmp
wget https://github.com/jgm/pandoc/releases/download/2.19.2/pandoc-2.19.2-linux-amd64.tar.gz
sudo tar xzvf pandoc-2.19.2-linux-amd64.tar.gz --strip-components 1 -C /usr/local
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: "3.11"
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: "16"
- name: Install FFmpeg
run: |
sudo apt-get update
sudo apt-get install -y ffmpeg
- name: Upgrade pip
run: python3 -m pip install --upgrade pip
- name: Get pip cache dir
id: pip-cache
run: echo "::set-output name=dir::$(pip cache dir)"
- name: Cache dependencies
uses: actions/cache@v3
with:
path: ${{ steps.pip-cache.outputs.dir }}
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: ${{ runner.os }}-pip-
- name: Install cleanlab
run: pip install -e ".[all]"
- name: Install dependencies
run: python3 -m pip install -r docs/requirements.txt
- name: Install katex
run: npm install -g katex
- name: Find and replace "%pip install cleanlab" with master branch in .ipynb files
if: ${{ github.ref_type == 'branch' }}
uses: jacobtomlinson/gha-find-replace@v2
with:
find: "%pip install cleanlab ${{ '#' }} for colab"
replace: "%pip install git+https://github.com/${{ github.repository }}.git@${{ github.sha }}"
include: "docs/source**.ipynb"
- name: Find and replace "%pip install cleanlab" with release tag in .ipynb files
if: ${{ github.ref_type == 'tag' }}
uses: jacobtomlinson/gha-find-replace@v2
with:
find: "%pip install cleanlab ${{ '#' }} for colab"
replace: "%pip install cleanlab==${{ github.ref_name }}"
include: "docs/source**.ipynb"
- name: Add and Commit changes to .ipynb files
run: |
git config --global user.email "actions@github.com"
git config --global user.name "GitHub Actions"
git add -A && git commit -m "Change cleanlab ver in .ipynb files"
- name: Change tag to the latest commit
if: ${{ github.ref_type == 'tag' }}
run: |
git tag -f $GITHUB_REF_NAME
- name: Run Sphinx with sphinx-multiversion wrapper - branch trigger
if: ${{ github.ref_type == 'branch' }}
env:
TF_CPP_MIN_LOG_LEVEL: 3
run: sphinx-multiversion docs/source cleanlab-docs -D smv_branch_whitelist=${{ github.ref_name }} -D smv_tag_whitelist=None
- name: Run Sphinx with sphinx-multiversion wrapper - tag trigger
if: ${{ github.ref_type == 'tag' }}
env:
TF_CPP_MIN_LOG_LEVEL: 3
run: sphinx-multiversion docs/source cleanlab-docs -D smv_branch_whitelist=None -D smv_tag_whitelist=${{ github.ref_name }}
- name: Get latest stable release
id: stable_release
continue-on-error: true
uses: pozetroninc/github-action-get-latest-release@master
with:
owner: ${{ github.repository_owner }}
repo: cleanlab
excludes: prerelease, draft
- name: Create latest_release.txt file
if: ${{ steps.stable_release.outcome == 'success' }}
run: echo ${{ steps.stable_release.outputs.release }} > cleanlab-docs/latest_release.txt
- name: Find and replace "placeholder_version_number" in versioning.js
if: ${{ steps.stable_release.outcome == 'success' }}
uses: jacobtomlinson/gha-find-replace@v2
with:
find: "placeholder_version_number"
replace: ${{ steps.stable_release.outputs.release }}
include: "docs/source/_templates/versioning.js"
- name: Find and replace "placeholder_commit_hash" in versioning.js
uses: jacobtomlinson/gha-find-replace@v2
with:
find: "placeholder_commit_hash"
replace: ${{ github.sha }}
include: "docs/source/_templates/versioning.js"
- name: Copy versioning JS file to cleanlab-docs/
run: |
cp docs/source/_templates/versioning.js cleanlab-docs/versioning.js
- name: Find and replace "stable_url" in redirect-to-stable.html
if: ${{ github.ref_type == 'tag' && steps.stable_release.outcome == 'success' }}
uses: jacobtomlinson/gha-find-replace@v2
with:
find: "stable_url"
replace: ${{ env.DOCS_SITE_URL }}stable/index.html
include: "docs/source/_templates/redirect-to-stable.html"
- name: Copy redirecting HTML file to cleanlab-docs/
if: ${{ github.ref_type == 'tag' }}
run: cp docs/source/_templates/redirect-to-stable.html cleanlab-docs/index.html
- name: Update OpenGraph URLs in HTML files
# This code fixes the URLs in the HTML files with OpenGraph tags.
# It uses a regular expression to capture two parts of the URL:
# $1: The first part of the URL, including the protocol and domain.
# $2: The rest of the URL, including the path and query string.
# The replacement string combines the captured parts with the ref name.
# This ensures that the ref name is inserted into the URL correctly.
env:
REF_URL_SEGMENT: ${{ (github.ref_type == 'tag' && steps.stable_release.outcome == 'success') && 'stable' || github.ref_name }}
uses: jacobtomlinson/gha-find-replace@v2
with:
find: '(<meta property="og:url" content="https?://[^/]+)/([^"]+")'
replace: '$1/${{ env.REF_URL_SEGMENT }}/$2'
include: "cleanlab-docs/**/*.html"
regex: true
- name: Deploy
if: ${{ (github.ref == 'refs/heads/master') || (github.ref_type == 'tag') }}
uses: peaceiris/actions-gh-pages@v3
with:
deploy_key: ${{ secrets.ACTIONS_DEPLOY_KEY }}
external_repository: ${{ github.repository_owner }}/cleanlab-docs
publish_branch: master
publish_dir: cleanlab-docs
keep_files: true
exclude_assets: ""
- uses: actions/upload-artifact@v3
with:
name: docs-html
path: cleanlab-docs
retention-days: 1 # don't need this except in link checking step below
links:
needs: deploy
runs-on: ubuntu-20.04
steps:
- uses: actions/download-artifact@v3
with:
name: docs-html
path: cleanlab-docs
- uses: anishathalye/proof-html@v1
with:
directory: ./cleanlab-docs
external_only: true
url_ignore_re: |
^https://pradyunsg.me/
^https://keras.io/