Skip to content

Commit 60e0be8

Browse files
authored
Merge pull request #3 from urandom-ctf/add-update-submodule
サブモジュールをアップデートするGitHub Actionsを追加
2 parents 34b73d5 + 2ffa207 commit 60e0be8

File tree

1 file changed

+24
-5
lines changed

1 file changed

+24
-5
lines changed

.github/workflows/deploy.yml

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ jobs:
1515
with:
1616
submodules: recursive # to fetch Hugo themes
1717

18+
- name: Update submodules
19+
run: git submodule update --remote --recursive
20+
1821
- uses: dorny/paths-filter@v3
1922
id: changes
2023
with:
@@ -23,6 +26,7 @@ jobs:
2326
- 'static/**'
2427
- '**/*.md'
2528
- 'layouts/**'
29+
- '!public/**'
2630
2731
- name: Setup Hugo
2832
uses: peaceiris/actions-hugo@v3
@@ -36,18 +40,33 @@ jobs:
3640
- uses: webfactory/[email protected]
3741
with:
3842
ssh-private-key: ${{ secrets.SSH_PRIVATE_DEPLOY_KEY }}
39-
if: github.event_name != 'pull_request' && steps.changes.outputs.src == 'true'
4043

41-
- name: Prepare Git setting, commit & push
44+
- name: Prepare Git setting
4245
run: |
4346
# `actions/checkout`が設定した`url.https://github.com/.insteadOf`を消しておく。
4447
# https://github.com/actions/checkout/blob/9a9194f87191a7e9055e3e9b95b8cfb13023bb08/adrs/0153-checkout-v2.md?plain=1#L261
4548
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: |
4654
cd public
47-
git config --local user.email "[email protected]"
48-
git config --local user.name "YOSHIMURA Yuu"
4955
git remote set-url origin [email protected]:urandom-ctf/urandom-ctf.github.io.git
5056
git add --all
51-
git commit -m 'Update website'
57+
git commit -m 'Update website by ${{ github.sha }}'
5258
git push origin master
5359
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'

0 commit comments

Comments
 (0)