Files
airship/.github/workflows/release.yml
T
Nayan ae8194f5e8 fix(ci): build the CLI before publishing it
pnpm publish runs no build. apps/cli has no prepack, prepare or
prepublishOnly hook, and the npm lifecycle never invokes a plain
`build` script, so in a clean CI checkout `files: ["dist"]` matched an
empty directory. v0.2.0 shipped a package.json and a LICENSE, nothing
else, and npm reported it as a clean publish.

The old "Validate packaging" step could not catch this: `publish
--dry-run` packs that same empty tarball and exits 0.

Both lanes now build explicitly and then run scripts/verify-tarball.sh,
which packs for real and asserts dist/index.js, both vendored IIFEs and
the three woff2 fonts are present, with a floor on total size.
2026-08-11 05:09:15 +05:30

63 lines
2.2 KiB
YAML

name: Release
run-name: "Release · ${{ github.ref_name }}"
# Publishes @airshiplabs/cli to npm when a cli-v* tag is pushed. Cut the release
# with `make release` (bumps apps/cli/package.json, commits, tags) then push the
# tag — see scripts/release.sh.
#
# This lane is for locally-cut releases only. publish.yml pushes its tag with
# GITHUB_TOKEN, and GitHub does not fire workflows from GITHUB_TOKEN-authored
# pushes, so a CI-cut release never lands here and the two never both publish.
on:
push:
tags: ["cli-v*"]
permissions:
contents: read
id-token: write # npm provenance attestation
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
cache: pnpm
registry-url: "https://registry.npmjs.org"
- run: pnpm install --frozen-lockfile
- name: Verify the tag matches apps/cli's version
run: |
TAG="${GITHUB_REF_NAME#cli-v}"
PKG=$(node -p "require('./apps/cli/package.json').version")
if [ "$TAG" != "$PKG" ]; then
echo "::error::Tag cli-v$TAG does not match @airshiplabs/cli version $PKG (cut releases with 'make release')"
exit 1
fi
# `pnpm publish` does NOT build the package. apps/cli has no prepack,
# prepare or prepublishOnly hook, and the npm lifecycle never invokes a
# plain `build` script — so nothing here builds unless this step does.
# Skip it and `files: ["dist"]` matches an empty directory, npm reports a
# clean publish, and the tarball ships a package.json and a LICENSE.
# v0.2.0 went out exactly that way.
- name: Build the CLI
run: pnpm turbo run build --filter=@airshiplabs/cli
# Packs for real and looks inside. `publish --dry-run` cannot stand in
# here — it packs the same empty tarball and exits 0.
- name: Verify the tarball is complete
run: bash scripts/verify-tarball.sh
- name: Publish to npm
run: pnpm --filter @airshiplabs/cli publish --access public --no-git-checks --provenance
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}