7
7
- master
8
8
pull_request :
9
9
10
+ permissions :
11
+ contents : read
12
+ pages : write
13
+ id-token : write
14
+
10
15
jobs :
11
- build-deploy :
12
- runs-on : self-hosted
16
+ build :
17
+ runs-on : ubuntu-latest
13
18
steps :
14
19
- uses : actions/checkout@v4
15
20
with :
16
21
submodules : recursive # to fetch Hugo themes
22
+ fetch-depth : 0
17
23
18
- - name : Update submodules
19
- run : git submodule update --remote --recursive
20
-
21
- - uses : dorny/paths-filter@v3
22
- id : changes
23
- with :
24
- filters : |
25
- src:
26
- - 'static/**'
27
- - '**/*.md'
28
- - 'layouts/**'
29
- - '!public/**'
30
-
24
+ - name : Setup Pages
25
+ id : pages
26
+ uses : actions/configure-pages@v5
27
+
31
28
- name : Setup Hugo
32
29
uses : peaceiris/actions-hugo@v3
33
30
with :
@@ -36,37 +33,19 @@ jobs:
36
33
37
34
- name : Build
38
35
run : hugo --minify
39
-
40
- -
uses :
webfactory/[email protected]
36
+
37
+ - name : Upload artifact
38
+ uses : actions/upload-pages-artifact@v3
41
39
with :
42
- ssh-private-key : ${{ secrets.SSH_PRIVATE_DEPLOY_KEY }}
43
-
44
- - name : Prepare Git setting
45
- run : |
46
- # `actions/checkout`が設定した`url.https://github.com/.insteadOf`を消しておく。
47
- # https://github.com/actions/checkout/blob/9a9194f87191a7e9055e3e9b95b8cfb13023bb08/adrs/0153-checkout-v2.md?plain=1#L261
48
- git submodule foreach --recursive git config --local --unset-all 'url.https://github.com/.insteadOf'
49
- git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
50
- git config --global user.name "github-actions[bot]"
51
-
52
- - name : Commit & push
53
- run : |
54
- cd public
55
- git remote set-url origin [email protected] :urandom-ctf/urandom-ctf.github.io.git
56
- git add --all
57
- git commit -m 'Update website by ${{ github.sha }}'
58
- git push origin master
59
- if : github.event_name != 'pull_request' && steps.changes.outputs.src == 'true'
60
-
61
- - name : Update submodule
62
- run : |
63
- git add public
64
- git commit -m "[skip ci] Update submodules by ${{ github.sha }}"
65
- if : github.event_name != 'pull_request' && steps.changes.outputs.src == 'true'
66
-
67
- - name : Push changes
68
- uses : ad-m/github-push-action@master
69
- with :
70
- github_token : ${{ secrets.GITHUB_TOKEN }}
71
- branch : master
72
- if : github.event_name != 'pull_request' && steps.changes.outputs.src == 'true'
40
+ path : ./public
41
+
42
+ deploy :
43
+ environment :
44
+ name : github-pages
45
+ url : ${{ steps.deployment.outputs.page_url }}
46
+ runs-on : ubuntu-latest
47
+ needs : build
48
+ steps :
49
+ - name : Deploy to GitHub Pages
50
+ id : deployment
51
+ uses : actions/deploy-pages@v4
0 commit comments