Skip to content

Post-release for 0.7.0 #73

Post-release for 0.7.0

Post-release for 0.7.0 #73

name: Build and Deploy Web Demo to GitHub Pages
on:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
inputs:
git_ref:
description: 'The git ref to checkout and build'
required: false
push:
branches:
- master
tags:
- v*
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write
# Allow only one concurrent deployment
concurrency:
group: "pages"
cancel-in-progress: false
jobs:
build:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.set-version.outputs.VERSION }}
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Determine version
id: set-version
run: |
VERSION="${{ github.event.inputs.git_ref || github.ref_name }}"
echo "VERSION=$VERSION" >> $GITHUB_ENV
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
- name: Build Web Demo
uses: ./.github/workflows/build-web-demo/
with:
git_ref: ${{ env.VERSION }}
- name: Setup Pages
uses: actions/configure-pages@v5
- name: Upload wasm-pack artifact
uses: actions/upload-pages-artifact@v3
with:
path: 'web/pkg/'
name: 'wasm'
- name: Upload Vite artifact
uses: actions/upload-pages-artifact@v3
with:
path: 'web/demo/dist/'
name: 'vite'
deploy:
runs-on: ubuntu-latest
needs: build
permissions:
contents: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Set VERSION environment variable
run: echo "VERSION=${{ needs.build.outputs.VERSION }}" >> $GITHUB_ENV
- name: Checkout gh-pages branch
uses: actions/checkout@v4
with:
ref: gh-pages
fetch-depth: 0
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: ./
- name: Extract artifact
run: |
set -e
PKG_DIR=pkg/${VERSION:?}
rm -rf "$PKG_DIR"
mkdir -p "$PKG_DIR"
tar -xvf wasm/artifact.tar -C "$PKG_DIR" --wildcards "*.js" "*.wasm"
rm wasm/artifact.tar
tar -xvf vite/artifact.tar
rm vite/artifact.tar
- name: Update versions.json
run: |
set -e
readarray -t versions < <(find pkg -mindepth 1 -maxdepth 1 -type d -not -name '.*' -printf '%P\n' | sort -Vr)
echo "[$(printf '"%s",' "${versions[@]}" | sed 's/,$//')]" > versions.json
- name: Create .nojekyll file
run: |
touch .nojekyll
- name: Commit and push changes
run: |
set -e
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add -A
git commit -m "Deploy ${VERSION:?}" || echo "No changes to commit"
git push origin gh-pages