ci: cherry-pickable docs workflow (#479)

This commit is contained in:
bd_ 2023-10-08 16:10:27 +09:00 committed by GitHub
parent dd2f15d533
commit 65d5af509e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 27 additions and 34 deletions

View File

@ -2,15 +2,12 @@ name: Deploy documentation
on:
push:
branches:
- ci
- main
- dev
workflow_dispatch:
- docs-snapshot
workflow_dispatch: {}
release:
types:
- released
- unpublished
- edited
permissions:
contents: read
@ -22,17 +19,36 @@ concurrency:
cancel-in-progress: true
jobs:
get_latest_release:
name: Get latest release
uses: bdunderscore/modular-avatar/.github/workflows/get-latest-release.yml@main
snapshot-docs:
name: Snapshot documentation
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v2
# Run on releases only
if: ${{ github.event.release }}
with:
ref: ${{ github.ref }}
fetch-depth: 0
fetch-tags: true
- name: Merge with existing branch
# Run on releases only
if: ${{ github.event.release }}
run: |
git config --global user.name "GitHub Actions"
git config --global user.email "github-actions@nadena.dev"
git merge -s ours origin/docs-snapshot
git push origin HEAD:docs-snapshot
build-docs:
name: Build documentation (latest release)
needs:
- get_latest_release
uses: bdunderscore/modular-avatar/.github/workflows/build-test-docs.yml@main
needs:
- snapshot-docs
with:
ref: ${{ needs.get_latest_release.outputs.latest_release_tag }}
ref: docs-snapshot
build-docs-dev:
name: Build documentation (main branch)

View File

@ -1,23 +0,0 @@
# This is isolated to its own workflow file to avoid leaking publish secrets into the
# github token
name: Get latest release
on:
workflow_call:
outputs:
latest_release_tag:
description: 'latest release tag'
value: ${{ jobs.get_latest_release.outputs.latest_release_tag }}
jobs:
get_latest_release:
name: Get latest release
runs-on: ubuntu-latest
steps:
- uses: pozetroninc/github-action-get-latest-release@v0.7.0
id: latest_release
with:
repository: bdunderscore/modular-avatar
token: ${{ secrets.GITHUB_TOKEN }}
excludes: "prerelease, draft"
- run: echo "latest_release_tag=${{ steps.latest_release.outputs.release }}"
outputs:
latest_release_tag: ${{ steps.latest_release.outputs.release }}