Isometric line figures that answer the pointer. For React and for anything with a DOM.
Release: the changelog, the publish workflow behind the release environment, and 0.1.0-rc.0
Lucas Marquesed367be34028
diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.ymlnew file mode 100644index 0000000..5b622d6--- /dev/null+++ b/.github/workflows/publish.yml@@ -0,0 +1,84 @@+name: Publish++on:+ push:+ tags:+ - 'v*'++permissions:+ # Writes the GitHub Release.+ contents: write+ # npm provenance: the OIDC token npm exchanges for a signed attestation of+ # where and how the tarball was built.+ id-token: write++jobs:+ publish:+ runs-on: ubuntu-latest+ # The protected `release` environment: a required reviewer approves before+ # any step runs, and NPM_TOKEN exists only here, so a pushed tag alone+ # cannot reach the registry.+ environment: release+ steps:+ - uses: actions/checkout@v7++ - name: Enable Corepack+ run: corepack enable++ # registry-url writes an .npmrc wired to NODE_AUTH_TOKEN, so the gate's+ # `npm whoami` and the publish below both authenticate with NPM_TOKEN.+ - uses: actions/setup-node@v7+ with:+ node-version: 22+ registry-url: https://registry.npmjs.org+ cache: pnpm++ - name: Install+ run: pnpm install --frozen-lockfile++ - name: Verify the tag matches the manifest+ run: |+ TAG="${GITHUB_REF_NAME#v}"+ PKG="$(node -p "require('./packages/hairline/package.json').version")"+ echo "tag=$TAG package=$PKG"+ if [ "$TAG" != "$PKG" ]; then+ echo "::error::Tag v$TAG does not match packages/hairline/package.json ($PKG). Refusing to publish."+ exit 1+ fi+ echo "VERSION=$TAG" >> "$GITHUB_ENV"+ # A version with a pre-release suffix (0.1.0-rc.0) goes to the `next`+ # dist-tag, so `npm install @lucasmarkes/hairline` never picks it up.+ case "$TAG" in+ *-*) echo "DIST_TAG=next" >> "$GITHUB_ENV" ;;+ *) echo "DIST_TAG=latest" >> "$GITHUB_ENV" ;;+ esac++ # Fails here, before anything is published, if the changelog has no+ # section for this version.+ - name: Release notes from the changelog+ run: node scripts/changelog.mjs "$VERSION" > "$RUNNER_TEMP/notes.md"++ # Everything: build, typecheck, every test layer, publint, attw, size+ # budgets, the tarball, both consumer fixtures, npm auth and the registry.+ # It packs but never publishes.+ - name: Release gate (full)+ run: pnpm run release+ env:+ NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}++ # pnpm packs (it runs prepack, which copies the README and LICENSE in);+ # npm publishes that exact tarball, because npm signs provenance.+ - name: Publish with provenance+ run: |+ STAGING="$(mktemp -d)"+ pnpm -C packages/hairline pack --pack-destination "$STAGING"+ npm publish "$STAGING/lucasmarkes-hairline-${VERSION}.tgz" --provenance --access public --tag "$DIST_TAG"+ env:+ NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}++ - name: GitHub Release+ run: |+ if [ "$DIST_TAG" = "next" ]; then PRE="--prerelease"; else PRE=""; fi+ gh release create "$GITHUB_REF_NAME" --title "$GITHUB_REF_NAME" --notes-file "$RUNNER_TEMP/notes.md" $PRE+ env:+ GH_TOKEN: ${{ github.token }}diff --git a/CHANGELOG.md b/CHANGELOG.mdnew file mode 100644index 0000000..7877b21--- /dev/null+++ b/CHANGELOG.md@@ -0,0 +1,21 @@+# Changelog++Every release of `@lucasmarkes/hairline`. The format follows+[Keep a Changelog](https://keepachangelog.com/en/1.1.0/); versions follow+[semver](https://semver.org/).++## 0.1.0 - 2026-10-01++First release.++### Added++- Six isometric line figures, each a function that draws into an element:+ `riffle`, `terrain`, `exploded`, `phosphor`, `slow`, `turntable`.+- A React entry, `@lucasmarkes/hairline/react`, with one component per figure.+ It is a client module, so it can be rendered from a Server Component.+- An `intensity` option on every figure, from 0 (subtle) to 1 (strong).+- Theming with six CSS custom properties (`--hairline-plate`, `--hairline-hi`,+ `--hairline-edge`, `--hairline-mid`, `--hairline-lo`, `--hairline-stroke`),+ a `theme` option, and automatic light and dark.+- A shadcn registry item at `https://hairline.lucasmarkes.com/r/hairline.json`.diff --git a/packages/hairline/package.json b/packages/hairline/package.jsonindex 05d9449..fea7a19 100644--- a/packages/hairline/package.json+++ b/packages/hairline/package.json@@ -1,6 +1,6 @@{"name": "@lucasmarkes/hairline",- "version": "0.0.0",+ "version": "0.1.0-rc.0","description": "Six isometric line figures that answer the pointer. For React and for anything with a DOM.","license": "MIT","type": "module",diff --git a/scripts/changelog.mjs b/scripts/changelog.mjsnew file mode 100644index 0000000..a503c89--- /dev/null+++ b/scripts/changelog.mjs@@ -0,0 +1,31 @@+#!/usr/bin/env node+/**+ * Prints one version's section of CHANGELOG.md, without its heading: the body+ * of the GitHub Release.+ *+ * node scripts/changelog.mjs 0.1.0+ *+ * A pre-release (0.1.0-rc.0) with no section of its own gets the section of+ * the version it leads to (0.1.0). No section at all is an error.+ */+import { readFileSync } from "node:fs";+import { join } from "node:path";++export function section(changelog, version) {+ const lines = changelog.split("\n");+ const heading = (v) => lines.findIndex((l) => l.startsWith("## ") && l.slice(3).trim().replace(/^\[|\].*$| .*$/g, "") === v);+ let start = heading(version);+ if (start < 0 && version.includes("-")) start = heading(version.split("-")[0]);+ if (start < 0) return null;+ let end = lines.findIndex((l, i) => i > start && l.startsWith("## "));+ if (end < 0) end = lines.length;+ return lines.slice(start + 1, end).join("\n").trim();+}++if (import.meta.filename === process.argv[1]) {+ const version = process.argv[2];+ if (!version) { console.error("Usage: node scripts/changelog.mjs <version>"); process.exit(2); }+ const notes = section(readFileSync(join(import.meta.dirname, "..", "CHANGELOG.md"), "utf8"), version);+ if (!notes) { console.error(`CHANGELOG.md has no "## ${version}" section.`); process.exit(1); }+ console.log(notes);+}