Skip to content

deploy-pages

deploy-pages #407

Workflow file for this run

name: deploy-pages
on:
push:
branches:
- master
paths:
- 'docs/**'
workflow_run:
workflows: ["deploy-release", "deploy-beta"]
types:
- completed
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
jobs:
build:
runs-on: ubuntu-latest
if: ${{ github.event_name != 'workflow_run' || github.event.workflow_run.conclusion == 'success' }}
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Download and deploy wasm artifacts
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
set -e
BETA_DOWNLOADED=false
STABLE_DOWNLOADED=false
# Attempt to download and deploy beta artifact
if gh release download beta --pattern 'mmapper-*-wasm.zip' --clobber -O beta_artifact.zip; then
unzip -o beta_artifact.zip
mv demo docs/beta
BETA_DOWNLOADED=true
echo "Beta artifact deployed to docs/beta."
else
echo "Beta wasm artifact not found."
fi
# Attempt to download and deploy stable artifact
LATEST_TAG=$(gh release list --exclude-pre-releases --limit 1 --json tagName --jq '.[0].tagName')
if [ -n "$LATEST_TAG" ] && gh release download "$LATEST_TAG" --pattern 'mmapper-*-wasm.zip' --clobber -O stable_artifact.zip; then
unzip -o stable_artifact.zip
mv demo docs/demo
STABLE_DOWNLOADED=true
echo "Latest stable release artifact deployed to docs/demo."
else
echo "Wasm artifact not found in latest stable release."
fi
# Fallback logic
if [ "$STABLE_DOWNLOADED" = false ] && [ "$BETA_DOWNLOADED" = true ]; then
echo "Stable release not found, using beta as fallback for /demo."
cp -r docs/beta docs/demo
fi
- name: Prepare Author and Changelog Include
run: |
cp NEWS.md docs/_includes/news.md
awk '
NF {
name = gensub(/\s+[^ ]+@[^ ]+\s+/, " ", "g", $0) # Strip email
print "- " name
}
' AUTHORS.txt > docs/_includes/authors.md
- name: Setup Pages
uses: actions/configure-pages@v5
- name: Build
uses: actions/jekyll-build-pages@v1
with:
source: ./docs
destination: ./_site
- name: Upload artifact
uses: actions/upload-pages-artifact@v4
with:
path: ./_site
deploy:
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}