Generate feeds and site #6854
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Generate feeds and site | |
on: | |
push: | |
branches: [ main ] | |
schedule: | |
# 1時間ごとに更新 | |
- cron: 0 * * * * | |
# NOTE: UTCなので9時間引く | |
# 平日 8~24時の1時間おき | |
# TODO: 9時(UTC0時)が実行されないことがあるので解決したい。恐らく0時登録が多いため実行されづらい | |
# - cron: 0 23,0-15 * * 1-5 | |
# 休日 8~24時の2時間おき | |
# - cron: 0 23,1,3,5,7,9,11,13,15 * * 0,6 | |
workflow_dispatch: | |
jobs: | |
generate-feed: | |
name: Generate Feed | |
runs-on: ubuntu-22.04 | |
timeout-minutes: 30 | |
steps: | |
- name: Git checkout | |
uses: actions/checkout@v4 | |
with: | |
ref: main | |
- name: Setup node | |
uses: actions/setup-node@v4 | |
with: | |
node-version-file: .tool-versions | |
cache: yarn | |
- name: Install node packages | |
run: yarn install | |
- name: Get date | |
id: get-date | |
run: | | |
echo "::set-output name=date::$(/bin/date -u "+%Y%m%d")" | |
shell: bash | |
- name: Cache feed images | |
uses: actions/cache@v4 | |
with: | |
path: .cache | |
key: ${{ runner.os }}-feed-images-${{ steps.get-date.outputs.date }} | |
- name: Generate feed | |
run: yarn feed-generate | |
- name: Generate site | |
run: yarn site-build | |
- name: Push to GitHub Pages | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./public | |
# NOTE: 変更履歴が必要な場合は false に変更 | |
force_orphan: true | |
user_name: 'github-actions[bot]' | |
user_email: 'github-actions[bot]@users.noreply.github.com' |