Deploy #9
This file contains hidden or 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
on: | |
workflow_dispatch: | |
inputs: | |
tag: | |
required: true | |
type: string | |
description: which tag (on the hyperquark/hyperquark repository) should we build from? | |
name: Deploy | |
jobs: | |
build: | |
name: Build WASM & website | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v4 | |
with: | |
repository: hyperquark/hyperquark | |
path: hyperquark | |
ref: ${{ inputs.tag }} | |
- name: Install nightly toolchain | |
uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: nightly | |
override: true | |
target: wasm32-unknown-unknown | |
- name: Install wasm-bindgen | |
uses: actions-rs/cargo@v1 | |
with: | |
command: install | |
args: -f wasm-bindgen-cli | |
- name: Install cargo-outdir | |
uses: actions-rs/cargo@v1 | |
with: | |
command: install | |
args: cargo-outdir | |
- name: Install node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: "20.x" | |
- name: Run npm install | |
run: | | |
cd $GITHUB_WORKSPACE/hyperquark | |
npm install | |
npm i -g vite | |
npm i -g binaryen@nightly | |
- name: Build | |
env: | |
VITE_HQ_VERSION_NAME: ${{ inputs.tag }} | |
run: | | |
cd $GITHUB_WORKSPACE/hyperquark | |
chmod +x build.sh && ./build.sh -Wpz | |
vite build --base=/ | |
- name: Move files to tmp | |
run: mv $GITHUB_WORKSPACE/hyperquark/playground/dist /tmp/hq-dist | |
- name: checkout website repo | |
uses: actions/checkout@v4 | |
with: | |
path: website | |
- name: move file to website repo | |
run: | | |
cd $GITHUB_WORKSPACE/website/pages | |
rm -rf assets index.html logo.png favicon.ico renderer.js | |
mv /tmp/hq-dist/* $GITHUB_WORKSPACE/website/pages/ | |
- name: Commit changes | |
uses: stefanzweifel/git-auto-commit-action@v5 | |
with: | |
repository: ./website | |
commit_message: Build website | |
pages: | |
needs: build | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
permissions: | |
pages: write | |
id-token: write | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Pages | |
uses: actions/configure-pages@v5 | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
path: 'pages' | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v4 | |
compute: | |
needs: [build, pages] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: stable | |
override: true | |
target: wasm32-wasip1 | |
- name: Setup node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: "20.x" | |
- name: Install fastly CLI | |
run: npm i -g @fastly/cli@latest | |
- name: Build compute | |
run: fastly compute build | |
- name: Purge previous version & deploy | |
env: | |
FASTLY_API_TOKEN : ${{ secrets.FASTLY_API_TOKEN }} | |
run: | | |
fastly purge --all | |
fastly compute deploy --domain=hyperquark.edgecompute.app --accept-defaults" | |