Skip to content

Gradient backgrounds as a color per cell #24

Gradient backgrounds as a color per cell

Gradient backgrounds as a color per cell #24

Workflow file for this run

name: Release
# On a version tag (v*): publish every public workspace package to npm
# (trusted publishing
# via OIDC — each package lists this workflow as a trusted publisher on
# npmjs.com), then deploy the Storybook and playground sites. Three jobs
# so a deploy hiccup can be re-run without re-publishing. Publishing
# MUST go through pnpm: `publishConfig.exports` (the src → dist swap) is
# pnpm-only.
on:
push:
tags: ["v*"]
permissions:
contents: read
jobs:
publish:
name: Publish to npm
runs-on: ubuntu-latest
timeout-minutes: 20
permissions:
contents: read
id-token: write # OIDC token for npm trusted publishing
steps:
- uses: actions/checkout@v7
- uses: pnpm/action-setup@v6
- uses: actions/setup-node@v7
with:
node-version-file: .nvmrc
cache: pnpm
registry-url: https://registry.npmjs.org
- run: pnpm install --frozen-lockfile
- name: Cache Playwright browsers
uses: actions/cache@v5
with:
path: ~/.cache/ms-playwright
key: playwright-${{ runner.os }}-${{ hashFiles('pnpm-lock.yaml') }}
- run: pnpm exec playwright install --with-deps chromium firefox webkit
# Deliberately repeats CI's check: a tag can point at a commit
# without green CI, and a publish is irreversible.
- run: pnpm check
# -r publishes in dependency order, so `workspace:^` resolves.
- run: pnpm -r publish --access public --no-git-checks
deploy:
name: Deploy Storybook
needs: publish
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v7
- uses: pnpm/action-setup@v6
- uses: actions/setup-node@v7
with:
node-version-file: .nvmrc
cache: pnpm
# Unfiltered: a filtered install fails on undeclared cross-package
# reaches (declarations guarded by scripts/check-workspace-deps.mjs).
- run: pnpm install --frozen-lockfile
# No repository is linked to this Netlify site, so this push of
# the built files is the only deploy path. The CLI must run from
# the site's base directory with an absolute --dir. Site id is
# public; NETLIFY_AUTH_TOKEN is a personal access token repo
# secret.
- name: Build and deploy
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: 5eacc1ae-4c03-47d9-b749-2d08c073f062
run: |
if [ -z "$NETLIFY_AUTH_TOKEN" ]; then
echo "NETLIFY_AUTH_TOKEN secret not set - skipping deploy"
exit 0
fi
pnpm --filter @monowind/storybook build
cd apps/storybook
npx -y netlify-cli@27 deploy --prod --no-build --dir "$PWD/storybook-static"
deploy-play:
name: Deploy playground
needs: publish
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v7
- uses: pnpm/action-setup@v6
- uses: actions/setup-node@v7
with:
node-version-file: .nvmrc
cache: pnpm
- run: pnpm install --frozen-lockfile
# Same arrangement as the Storybook site: GitHub Actions builds,
# `netlify deploy --prod` pushes the finished files (site:
# monowind-play, → play.monowind.benface.com) and bundles the
# short-link functions — the directory is passed explicitly: the
# CLI does not resolve netlify.toml's [functions] directory from
# inside this workspace package.
- name: Build and deploy
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: 24201d4d-2408-4b28-a8be-e2ad25fdb6da
run: |
if [ -z "$NETLIFY_AUTH_TOKEN" ]; then
echo "NETLIFY_AUTH_TOKEN secret not set - skipping deploy"
exit 0
fi
pnpm --filter @monowind/play build
cd apps/play
npx -y netlify-cli@27 deploy --prod --no-build --dir "$PWD/dist" --functions "$PWD/netlify/functions"
# The functions only run on Netlify, so the live short-link round
# trip is checked right after the deploy: a bundling or Blobs
# problem fails this job instead of reaching the first user.
- name: Verify short links
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
run: |
if [ -z "$NETLIFY_AUTH_TOKEN" ]; then
exit 0
fi
site=https://play.monowind.benface.com
id=$(curl -fsS --retry 5 --retry-all-errors --retry-delay 3 -X POST "$site/api/share" \
-H 'content-type: application/json' -d '{"target":"/"}' | sed 's/.*"id":"\([^"]*\)".*/\1/')
test -n "$id"
location=$(curl -fsS -o /dev/null -w '%{redirect_url}' "$site/s/$id")
test "$location" = "$site/"