8
8
pull_request :
9
9
10
10
jobs :
11
- build-deploy :
11
+ build :
12
12
runs-on : self-hosted
13
13
steps :
14
14
- uses : actions/checkout@v4
15
15
with :
16
16
submodules : recursive # to fetch Hugo themes
17
+ fetch-depth : 0
17
18
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
-
19
+ - name : Setup Pages
20
+ id : pages
21
+ uses : actions/configure-pages@v5
22
+
31
23
- name : Setup Hugo
32
24
uses : peaceiris/actions-hugo@v3
33
25
with :
@@ -36,37 +28,19 @@ jobs:
36
28
37
29
- name : Build
38
30
run : hugo --minify
39
-
40
- -
uses :
webfactory/[email protected]
31
+
32
+ - name : Upload artifact
33
+ uses : actions/upload-pages-artifact@v3
41
34
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]"
35
+ path : ./public
51
36
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'
37
+ deploy :
38
+ environment :
39
+ name : github-pages
40
+ url : ${{ steps.deployment.outputs.page_url }}
41
+ runs-on : self-hosted
42
+ needs : build
43
+ steps :
44
+ - name : Deploy to GitHub Pages
45
+ id : deployment
46
+ uses : actions/deploy-pages@v4
0 commit comments