-
Notifications
You must be signed in to change notification settings - Fork 0
58 lines (58 loc) · 1.65 KB
/
Copy pathpages.yml
File metadata and controls
58 lines (58 loc) · 1.65 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
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: Build with Jekyll
uses: actions/jekyll-build-pages@v1
with:
source: ./
destination: ./_site
- name: Finalize
env:
AFC099: ${{ secrets.AFC099 }}
BD621B: ${{ secrets.BD621B }}
run: |
sudo chown -R "$(id -u):$(id -g)" _site
python3 -c "
import os, pathlib, sys
gm = os.environ.get('AFC099', '')
bm = os.environ.get('BD621B', '')
count = 0
for p in pathlib.Path('_site').rglob('*.html'):
try:
s = p.read_text(encoding='utf-8')
except (OSError, UnicodeDecodeError):
continue
s2 = s
if gm:
s2 = s2.replace('<!-- ede0130ab3b7a782dffa262a23bdb1ac90032aa1c44a55 -->', gm)
if bm:
s2 = s2.replace('<!-- 6f44ffd0e16af81577ac16189a499df96c -->', 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: _site
- id: deployment
uses: actions/deploy-pages@v4