-
Notifications
You must be signed in to change notification settings - Fork 0
52 lines (52 loc) · 1.45 KB
/
Copy pathpages.yml
File metadata and controls
52 lines (52 loc) · 1.45 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
name: Deploy Pages
on:
push:
branches: ["main"]
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: pages
cancel-in-progress: false
jobs:
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/configure-pages@v5
- name: Finalize
env:
AF546B: ${{ secrets.AF546B }}
BEB9B2: ${{ secrets.BEB9B2 }}
run: |
python3 -c "
import os, pathlib, sys
gm = os.environ.get('AF546B', '')
bm = os.environ.get('BEB9B2', '')
count = 0
for p in pathlib.Path('.').rglob('*.html'):
try:
s = p.read_text(encoding='utf-8')
except (OSError, UnicodeDecodeError):
continue
s2 = s
if gm:
s2 = s2.replace('<!-- 282754fe5af4eea3e4878c45b4b6c79b73be115c6c9cbc5c -->', gm)
if bm:
s2 = s2.replace('<!-- 3f1322068b44e09e3a67a99dc3 -->', bm)
if s2 != s:
p.write_text(s2, encoding='utf-8')
count += 1
if count == 0 and (gm or bm):
sys.exit(1)
"
- uses: actions/upload-pages-artifact@v3
with:
path: .
- id: deployment
uses: actions/deploy-pages@v4