modular-avatar/.github/workflows/deploy-pages.yml

97 lines
2.2 KiB
YAML
Raw Normal View History

2022-09-10 08:18:35 +08:00
name: Deploy documentation
2022-09-08 11:46:13 +08:00
on:
push:
branches:
2022-09-09 11:37:40 +08:00
- main
- docs-snapshot
workflow_dispatch: {}
release:
types:
- released
2022-09-09 11:37:40 +08:00
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: "pages"
cancel-in-progress: true
2022-09-08 11:46:13 +08:00
jobs:
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
2022-09-09 12:01:14 +08:00
build-docs:
name: Build documentation (latest release)
2023-03-25 13:54:29 +08:00
uses: bdunderscore/modular-avatar/.github/workflows/build-test-docs.yml@main
needs:
- snapshot-docs
with:
ref: docs-snapshot
2023-03-25 13:22:48 +08:00
build-docs-dev:
name: Build documentation (main branch)
2023-03-25 13:54:29 +08:00
uses: bdunderscore/modular-avatar/.github/workflows/build-test-docs.yml@main
2023-03-25 13:22:48 +08:00
with:
ref: main
2023-03-25 13:22:48 +08:00
path: dev
artifact: docs-dev
2022-09-10 08:18:35 +08:00
deploy-docs:
2022-09-10 08:57:52 +08:00
name: Deploy documentation
2023-03-25 13:22:48 +08:00
needs:
- build-docs
- build-docs-dev
2022-09-08 11:46:13 +08:00
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
2022-09-10 08:18:35 +08:00
2022-09-08 11:46:13 +08:00
steps:
2022-09-10 08:18:35 +08:00
- name: Download artifact
uses: actions/download-artifact@v3
2022-09-08 11:46:13 +08:00
with:
2022-09-10 08:18:35 +08:00
name: docs
path: docs/build
2023-03-25 13:22:48 +08:00
- name: Download artifact
uses: actions/download-artifact@v3
2023-03-25 13:22:48 +08:00
with:
name: docs-dev
path: docs/build/dev
2023-03-25 13:57:38 +08:00
- name: Dump file listing
2023-03-25 13:22:48 +08:00
run: |
ls -lR docs/build
2022-09-08 11:46:13 +08:00
- name: Setup Pages
uses: actions/configure-pages@v3
2022-09-08 11:46:13 +08:00
- name: Upload artifact
uses: actions/upload-pages-artifact@v2
2022-09-08 11:46:13 +08:00
with:
2022-09-09 11:37:40 +08:00
path: docs/build
2022-09-08 11:46:13 +08:00
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2