Skip to content

chore(deps): update clap packages to v4.5.49 (#1116) #148

chore(deps): update clap packages to v4.5.49 (#1116)

chore(deps): update clap packages to v4.5.49 (#1116) #148

Workflow file for this run

name: Build and deploy website
on:
push:
branches: main
jobs:
# Build the WASM-based web playground's assets
# NOTE The playground is currently not under active development, so we
# checkout from the `playground` branch, which diverged from `main`
# circa October 2024.
build-playground:
name: Build playground WASM assets
runs-on: ubuntu-latest
steps:
- name: Checkout
id: checkout-playground
uses: actions/checkout@v5
with:
ref: playground
- name: Cache build artefacts
id: cache-artefacts
uses: actions/cache@v4
with:
path: wasm-assets
key: playground-wasm-assets-${{ steps.checkout-playground.outputs.commit }}
- name: Install Nix
if: steps.cache-artefacts.outputs.cache-hit != 'true'
uses: cachix/install-nix-action@v31
with:
nix_path: nixpkgs=channel:nixpkgs-unstable
- name: Set up Nix cache
if: steps.cache-artefacts.outputs.cache-hit != 'true'
uses: cachix/cachix-action@v16
with:
name: tweag-topiary
authToken: "${{ secrets.CACHIX_TWEAG_TOPIARY_AUTH_TOKEN }}"
- name: Build WASM assets
if: steps.cache-artefacts.outputs.cache-hit != 'true'
run: |
nix build .#topiary-playground
# Copy the Nix build results into a new directory because the
# caching step doesn't like the `result` symlink to the store
mkdir wasm-assets
cp -r result/* wasm-assets
- name: Upload assets as build artefacts
uses: actions/upload-artifact@v4
with:
name: playground-wasm-assets
path: wasm-assets
build-website:
name: Build website
runs-on: ubuntu-latest
needs: build-playground
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Install Nix
uses: cachix/install-nix-action@v31
with:
nix_path: nixpkgs=channel:nixpkgs-unstable
- name: Set up Nix cache
uses: cachix/cachix-action@v16
with:
name: tweag-topiary
authToken: "${{ secrets.CACHIX_TWEAG_TOPIARY_AUTH_TOKEN }}"
- name: Prepare directories
run: |
mkdir -p web-playground/src/wasm-app
mkdir -p web-playground/src/samples
- name: Download playground WASM artefacts
uses: actions/download-artifact@v5
with:
name: playground-wasm-assets
path: web-playground/src/wasm-app
- name: Move sample input and queries into frontend
run: |
mv web-playground/src/wasm-app/languages_export.ts \
web-playground/src/samples
# NOTE There are end-to-end tests for the web playground. Because
# of the playground's development status, we don't currently
# bother running them, to speed up the CI. Something like the
# following will do the trick, if that ever changes:
#
# ```yaml
# - name: Test playground
# run: |
# npm install --prefix web-playground
# npm run dev --prefix web-playground &
#
# # Loop until there's a response
# while [[ "$(curl --silent --output /dev/null --write-out "%{http_code}" http://localhost:5173/playground)" != "200" ]]; do
# sleep 2
# done
#
# npm run e2e --prefix web-playground
# ```
- name: Build frontend and decant it into website
run: |
npm install --prefix web-playground
npm run build --prefix web-playground
rm -rf website/playground
cp -r web-playground/dist website/playground
- name: Build Topiary Book and decant it into website
run: |
mkdir website/book
nix build .#topiary-book
cp -r result/* website/book
- name: Upload GitHub Pages artefact
uses: actions/upload-pages-artifact@v4
with:
path: website
deploy-website:
name: Deploy website
runs-on: ubuntu-latest
needs: build-website
permissions:
pages: write # to deploy to Pages
id-token: write # to verify the deployment originates from an appropriate source
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4