👷Update workflows #75
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
# GitHub Actions to automate deployment of project documentation | |
# Reference: https://squidfunk.github.io/mkdocs-material/publishing-your-site/?h=git+hub#github-pages | |
name: ci | |
on: | |
# 直接プッシュ時([skip ci]がないもの) | |
push: | |
branches: | |
- main | |
# 他のワークフローの完了時 | |
workflow_run: | |
workflows: | |
- "Update pre-commit Hooks" | |
- "Update Requirements after Dependabot Merge" | |
types: | |
- completed | |
branches: | |
- main | |
env: | |
cache_id: "" | |
permissions: | |
contents: write | |
jobs: | |
deploy: | |
# 実行条件: | |
# 1. pushイベントの場合 | |
# - [skip ci]がコミットメッセージに含まれていない | |
# - Dependabotによるマージではない | |
# 2. workflow_runイベントの場合 | |
# - 監視対象のワークフローが成功している | |
if: (github.event_name == 'push' && !contains(github.event.head_commit.message, '[skip ci]') && github.actor != 'dependabot[bot]') || (github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success') | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: 3.x | |
- run: echo "cache_id=$(date --utc '+%V')" >> "$GITHUB_ENV" | |
- uses: actions/cache@v4 | |
with: | |
key: mkdocs-material-${{ env.cache_id }} | |
path: .cache | |
restore-keys: | | |
mkdocs-material- | |
- name: Install Poetry | |
run: pip install poetry | |
- name: Poetry Setup | |
run: poetry install | |
- name: Deploy GitHub Pages | |
run: poetry run mkdocs gh-deploy --force |