Deploy #16
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
name: Deploy | |
on: | |
workflow_dispatch: | |
inputs: | |
deploy: | |
description: Deploy the output to GitHub Pages | |
type: choice | |
required: true | |
default: 'true' | |
options: | |
- true | |
- false | |
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. | |
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. | |
concurrency: | |
group: "pages" | |
cancel-in-progress: false | |
env: | |
REGISTRY: ghcr.io | |
jobs: | |
build-push-image-and-publish: | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
pages: write | |
packages: write | |
attestations: write | |
id-token: write | |
steps: | |
- name: Checkout this repository | |
uses: actions/checkout@v4 | |
- name: Log in to the Container registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Get lowercase repository name | |
id: repo_name | |
uses: ASzc/change-string-case-action@v6 | |
with: | |
string: ${{ github.repository }} | |
- name: Build and push Docker image | |
id: push | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
push: true | |
tags: ${{ env.REGISTRY }}/${{ steps.repo_name.outputs.lowercase }}:latest | |
build-args: | | |
WASM_DEBUG=sourcemap | |
WASM_SOURCEMAP_BASE=/playground/ | |
# Export both as a container image and in the out directory | |
outputs: | | |
type=docker | |
out | |
- name: Generate artifact attestation | |
uses: actions/attest-build-provenance@v1 | |
with: | |
subject-name: ${{ env.REGISTRY }}/${{ steps.repo_name.outputs.lowercase }} | |
subject-digest: ${{ steps.push.outputs.digest }} | |
push-to-registry: true | |
- name: Prepare pages artifact | |
run: tar --dereference --hard-dereference -cf github-pages.tar --directory out/www . | |
- name: Upload pages artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: github-pages | |
path: github-pages.tar | |
if-no-files-found: error | |
- name: Deploy | |
id: deployment | |
if: ${{ github.event.inputs.deploy == 'true' }} | |
uses: actions/deploy-pages@v4 |