-
Notifications
You must be signed in to change notification settings - Fork 700
executable file
·99 lines (88 loc) · 2.78 KB
/
github-pages.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
name: github-pages-app-dev
on:
push:
branches:
- app/dev
#TRIGGER on PR if changes made to below file-paths.
pull_request:
types:
- opened
- synchronize
branches:
- main
paths:
- "src/db.py"
- "src/requirements.txt"
- "src/docs/conf.py"
- "src/docs/Makefile"
- "src/docs/make.bat"
- "src/docs/_static/styles.css"
- "src/docs/_static/intel.css"
- "src/docs/_static/assets/logo-energyblue-white.svg"
- "src/docs/_static/sample_db_prd.json"
- "src/docs/_static/assets/favicon.ico"
- "src/docs/_static/script.js"
- "src/docs/_templates/base.html"
- "src/docs/_templates/index.html"
# defaults:
# run:
# working-directory: src
jobs:
pages:
name: Build GitHub Pages
runs-on: ubuntu-latest
steps:
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.8"
# - run: find | sort
- uses: actions/checkout@v3
# with:
# path: app/dev
# Adding above 2 lines forces pre-pending filepaths below w/ 'app/dev/filepath'
- uses: actions/checkout@v3
name: Check out main
with:
ref: 'refs/heads/main
path: main
# TODO: change to 'python3 app/dev/src/db.py main' per actions/checkout@3
- name: Build JSON DB
run: |
python3 -m pip install -r src/requirements.txt
echo main
python3 src/db.py main
- name: Remove JSON pre-prod
run: |
rm -rf src/docs/sample_db_pre.json
- name: Build Sphinx
run: |
python3 -m pip install -r src/requirements.txt
python3 -m sphinx -W -b html src/docs/ src/docs/_build/
echo $PWD
echo ${{ github.ref }}
- name: Add GPU-Occupancy-Calculator
env:
GPU_OCC_CALC: src/docs/_build/Tools/GPU-Occupancy-Calculator/
run: |
mkdir -p ${GPU_OCC_CALC}
cd ${GPU_OCC_CALC}
wget https://raw.githubusercontent.com/oneapi-src/oneAPI-samples/main/Tools/GPU-Occupancy-Calculator/index.html
- name: Push docs
if: ${{ github.ref == 'refs/heads/app/dev' }}
env:
GITHUB_USER: ${{ github.actor }}
GITHUB_TOKEN: ${{ github.token }}
GITHUB_REPO: ${{ github.repository }}
run: |
cd src/docs/_build/
touch .nojekyll
git init
git remote add origin "https://${GITHUB_USER}:${GITHUB_TOKEN}@github.com/${GITHUB_REPO}"
git add -A
git status
git config --global user.name "GitHub Actions"
git config --global user.email "[email protected]"
git commit -sm "$(date)"
git branch -M gh-pages
git push -u origin -f gh-pages