Skip to content

Change repository #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 27 additions & 48 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,24 @@ on:
- master
pull_request:

permissions:
contents: read
pages: write
id-token: write

jobs:
build-deploy:
runs-on: self-hosted
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive # to fetch Hugo themes
fetch-depth: 0

- name: Update submodules
run: git submodule update --remote --recursive

- uses: dorny/paths-filter@v3
id: changes
with:
filters: |
src:
- 'static/**'
- '**/*.md'
- 'layouts/**'
- '!public/**'

- name: Setup Pages
id: pages
uses: actions/configure-pages@v5

- name: Setup Hugo
uses: peaceiris/actions-hugo@v3
with:
Expand All @@ -36,37 +33,19 @@ jobs:

- name: Build
run: hugo --minify

- uses: webfactory/[email protected]

- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
ssh-private-key: ${{ secrets.SSH_PRIVATE_DEPLOY_KEY }}

- name: Prepare Git setting
run: |
# `actions/checkout`が設定した`url.https://github.com/.insteadOf`を消しておく。
# https://github.com/actions/checkout/blob/9a9194f87191a7e9055e3e9b95b8cfb13023bb08/adrs/0153-checkout-v2.md?plain=1#L261
git submodule foreach --recursive git config --local --unset-all 'url.https://github.com/.insteadOf'
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"

- name: Commit & push
run: |
cd public
git remote set-url origin [email protected]:urandom-ctf/urandom-ctf.github.io.git
git add --all
git commit -m 'Update website by ${{ github.sha }}'
git push origin master
if: github.event_name != 'pull_request' && steps.changes.outputs.src == 'true'

- name: Update submodule
run: |
git add public
git commit -m "[skip ci] Update submodules by ${{ github.sha }}"
if: github.event_name != 'pull_request' && steps.changes.outputs.src == 'true'

- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: master
if: github.event_name != 'pull_request' && steps.changes.outputs.src == 'true'
path: ./public

deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
4 changes: 1 addition & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
[submodule "themes/fuji"]
path = themes/fuji
url = https://github.com/dsrkafuu/hugo-theme-fuji.git
[submodule "public"]
path = public
url = https://github.com/urandom-ctf/urandom-ctf.github.io.git

1 change: 0 additions & 1 deletion public
Submodule public deleted from 2faf00
Loading