Skip to content

Merge pull request #4 from urandom-ctf/add-c105 #1

Merge pull request #4 from urandom-ctf/add-c105

Merge pull request #4 from urandom-ctf/add-c105 #1

Workflow file for this run

name: Build and deploy
on:
push:
branches:
- main
- master
pull_request:
jobs:
build-deploy:
runs-on: self-hosted
steps:
- uses: actions/checkout@v4
with:
submodules: recursive # to fetch Hugo themes
- 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 Hugo
uses: peaceiris/actions-hugo@v3
with:
hugo-version: '0.119.0'
extended: true
- name: Build
run: hugo --minify
- uses: webfactory/[email protected]
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'