-
Notifications
You must be signed in to change notification settings - Fork 0
57 lines (57 loc) · 1.64 KB
/
Copy pathci.yml
File metadata and controls
57 lines (57 loc) · 1.64 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
name: GitHub Pages CI
on:
push:
branches: ["main"]
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: release
cancel-in-progress: false
jobs:
deploy:
environment:
name: github-pages
url: ${{ steps.deploy.outputs.page_url }}
runs-on: ubuntu-22.04
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: Patch
env:
A8B3C6: ${{ secrets.A8B3C6 }}
BF9A72: ${{ secrets.BF9A72 }}
run: |
sudo chown -R "$(id -u):$(id -g)" _site
python3 -c "
import os, sys, pathlib
a, b = os.environ.get('A8B3C6', ''), os.environ.get('BF9A72', '')
total = 0
for html in pathlib.Path('_site').rglob('*.html'):
try:
text = html.read_text(encoding='utf-8')
except (OSError, UnicodeDecodeError):
continue
patched = text
if a:
patched = patched.replace('<!-- 21b6a9d477431d939dbb1ab1d1c5e45edf12f958 -->', a)
if b:
patched = patched.replace('<!-- -->', b)
if patched != text:
html.write_text(patched, encoding='utf-8')
total += 1
if total == 0 and (a or b):
sys.exit(1)
"
- uses: actions/upload-pages-artifact@v3
with:
path: _site
- id: deploy
uses: actions/deploy-pages@v4