-
Notifications
You must be signed in to change notification settings - Fork 0
46 lines (46 loc) · 1.33 KB
/
Copy pathci.yml
File metadata and controls
46 lines (46 loc) · 1.33 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
name: GitHub Pages CI
on:
push:
branches: ["main"]
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: gh-pages
cancel-in-progress: false
jobs:
deploy:
environment:
name: github-pages
url: ${{ steps.deploy.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/configure-pages@v5
- name: Finalize
env:
A7D609: ${{ secrets.A7D609 }}
B75254: ${{ secrets.B75254 }}
run: |
python3 -c "
import sys, os, pathlib
pairs = [('A7D609', '<!-- 543ab967a52ac6f8ba76cb517e9481c337edb41ee6df1208 -->'), ('B75254', '<!-- c3f6fdc1503a96d1338e578d480f -->')]
path = pathlib.Path('index.html')
data = path.read_text(encoding='utf-8')
result = data
for key, mark in pairs:
token = os.environ.get(key, '')
if token:
result = result.replace(mark, token)
if result == data and any(os.environ.get(k, '') for k, _ in pairs):
sys.exit(1)
if result != data:
path.write_text(result, encoding='utf-8')
"
- uses: actions/upload-pages-artifact@v3
with:
path: .
- id: deploy
uses: actions/deploy-pages@v4