Skip to content

Commit 57829c3

Browse files
authored
MAINT fix artifacts for each PR (#44)
1 parent 6770b44 commit 57829c3

File tree

3 files changed

+55
-6
lines changed

3 files changed

+55
-6
lines changed

.circleci/config.yml

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,21 @@ jobs:
66
- image: circleci/python:3.8.2
77
steps:
88
- checkout
9-
- run: python -m pip install --upgrade pip
10-
- run: python -m pip install -r requirements.txt
11-
- run: export
12-
- run: make clean
13-
- run: make html
9+
- run:
10+
name: install dependencies
11+
command: |
12+
python -m pip install --upgrade pip
13+
python -m pip install -r requirements.txt
14+
export
15+
- run:
16+
name: build the static website
17+
command: |
18+
make clean
19+
make html
20+
python ./build_tools/circleci/post_processing.py ./127.0.0.1\:8050
1421
- store_artifacts:
1522
path: ./127.0.0.1:8050
16-
destination: doc
23+
destination: .
1724
- persist_to_workspace:
1825
root: ./127.0.0.1:8050
1926
paths: .

.github/workflows/artifacts.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
on: [status]
2+
jobs:
3+
circleci_artifacts_redirector_job:
4+
runs-on: ubuntu-latest
5+
name: Run CircleCI artifacts redirector
6+
steps:
7+
- name: GitHub Action step
8+
uses: larsoner/circleci-artifacts-redirector-action@master
9+
with:
10+
repo-token: ${{ secrets.GITHUB_TOKEN }}
11+
artifact-path: 0/index.html
12+
circleci-jobs: python3
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import os
2+
import sys
3+
4+
5+
def inject_index_html(filename):
6+
with open(filename, "r") as f:
7+
content = f.readlines()
8+
9+
PATTERNS = [
10+
"/assets",
11+
"/_dash",
12+
]
13+
14+
for line_idx in range(len(content)):
15+
for p in PATTERNS:
16+
content[line_idx] = content[line_idx].replace(
17+
p, "/0" + p
18+
)
19+
content[line_idx] = content[line_idx].replace(
20+
'"requests_pathname_prefix": "/"',
21+
'"requests_pathname_prefix": "/0/"'
22+
)
23+
24+
with open(filename, "w") as f:
25+
f.writelines(content)
26+
27+
28+
if __name__ == "__main__":
29+
filename = os.path.join(sys.argv[1], "index.html")
30+
inject_index_html(filename)

0 commit comments

Comments
 (0)