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

103 lines
2.5 KiB
YAML

name: Deploy documentation
on:
push:
branches:
- main
- docs-snapshot
workflow_dispatch: {}
release:
types:
- released
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: "pages"
cancel-in-progress: true
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
build-docs:
name: Build documentation (latest release)
uses: bdunderscore/modular-avatar/.github/workflows/build-test-docs.yml@main
needs:
- snapshot-docs
with:
ref: docs-snapshot
build-docs-dev:
name: Build documentation (main branch)
uses: bdunderscore/modular-avatar/.github/workflows/build-test-docs.yml@main
with:
ref: main
path: dev
artifact: docs-dev
deploy-docs:
name: Deploy documentation
needs:
- build-docs
- build-docs-dev
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Download artifact
uses: actions/download-artifact@v3
with:
name: docs
path: docs/build
- name: Download artifact
uses: actions/download-artifact@v3
with:
name: docs-dev
path: docs/build/dev
- name: Dump file listing
run: |
ls -lR docs/build
- name: Unpack documentation
run: |
tar -xf docs/build/docs.tar -C docs/build
tar -xf docs/build/dev/docs.tar -C docs/build/dev
rm -f docs/build/docs.tar docs/build/dev/docs.tar
- name: Setup Pages
uses: actions/configure-pages@v3
- name: Upload artifact
uses: actions/upload-pages-artifact@v2
with:
path: docs/build
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2