From 6621494b0b17c8455f0a7a127d05042089f5be6d Mon Sep 17 00:00:00 2001 From: nfebe Date: Sun, 30 Aug 2026 04:12:42 +0100 Subject: [PATCH 1/3] chore: Release 0.1.0 to GitHub Packages Published on a tag, with the tag and the manifest checked against each other so a version cannot name a package it is not. On its own version line rather than the core it is used by: this is a library, and what a consumer needs to know is whether its own interface changed. --- .github/workflows/release.yml | 62 +++++++++++++++++++++++++++++++++++ package.json | 7 ++++ 2 files changed, 69 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..5615a15 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,62 @@ +name: Release + +on: + workflow_dispatch: + inputs: + version: + description: 'Version to release (e.g., 1.0.0-beta.2)' + required: true + push: + tags: + - 'v*' + +permissions: + contents: write + packages: write + +jobs: + release: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-node@v4 + with: + node-version: 22 + registry-url: https://npm.pkg.github.com + scope: '@sourceant' + + - name: Read version from file + id: version + run: echo "version=$(node -p "require('./package.json').version")" >> $GITHUB_OUTPUT + + # The tag and the manifest have to agree, or the package published under + # a tag is not the one that tag names. + - name: Validate version + run: | + FILE_VERSION="$(node -p "require('./package.json').version")" + if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then + RELEASE_VERSION="${{ github.event.inputs.version }}" + else + RELEASE_VERSION="${GITHUB_REF_NAME#v}" + fi + if [ "$RELEASE_VERSION" != "$FILE_VERSION" ]; then + echo "::error::Version mismatch: Input/Tag ($RELEASE_VERSION) != package.json ($FILE_VERSION)" + exit 1 + fi + echo "Version validated: $FILE_VERSION" + + - name: Every export resolves + run: node scripts/check-exports.mjs + + - name: Publish + run: npm publish + env: + NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Create Release + uses: softprops/action-gh-release@v2 + with: + tag_name: v${{ steps.version.outputs.version }} + name: v${{ steps.version.outputs.version }} + generate_release_notes: true diff --git a/package.json b/package.json index 0928153..456736e 100644 --- a/package.json +++ b/package.json @@ -4,6 +4,13 @@ "description": "SourceAnt design system: tokens, primitives, and the graph renderer", "license": "MIT", "type": "module", + "repository": { + "type": "git", + "url": "git+https://github.com/sourceant/design.git" + }, + "publishConfig": { + "registry": "https://npm.pkg.github.com" + }, "sideEffects": [ "*.css" ], From 06ec31f8e8d13d5e57387d54f268b3da4a1d45a1 Mon Sep 17 00:00:00 2001 From: nfebe Date: Sun, 30 Aug 2026 13:05:58 +0100 Subject: [PATCH 2/3] docs: Add a changelog and release from it The release notes were generated from commit titles. A written entry says what the package is, and the release fails before publishing if the version it is cutting has no entry. --- .github/workflows/release.yml | 20 +++++++++++++++++++- CHANGELOG.md | 23 +++++++++++++++++++++++ 2 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 CHANGELOG.md diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 5615a15..256dd7f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -49,6 +49,24 @@ jobs: - name: Every export resolves run: node scripts/check-exports.mjs + # Read before publishing, because a version published without notes + # cannot be published again to add them. + - name: Release notes from the changelog + run: | + VERSION="${{ steps.version.outputs.version }}" + awk -v version="$VERSION" ' + BEGIN { found=0; printing=0 } + /^## \[/ { + if (found && printing) exit + if ($0 ~ "\\[" version "\\]") { found=1; printing=1; next } + } + found && printing { print } + ' CHANGELOG.md > "${{ runner.temp }}/notes.md" + if [ ! -s "${{ runner.temp }}/notes.md" ]; then + echo "::error::No changelog entry for $VERSION" + exit 1 + fi + - name: Publish run: npm publish env: @@ -59,4 +77,4 @@ jobs: with: tag_name: v${{ steps.version.outputs.version }} name: v${{ steps.version.outputs.version }} - generate_release_notes: true + body_path: ${{ runner.temp }}/notes.md diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..fd12831 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,23 @@ +# Changelog + +All notable changes to this project are documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [Unreleased] + +## [0.1.0] - 2026-08-30 + +First release. Versioned on its own, because nothing about the components is +tied to a release of the core. + +### Added + +- Twenty five components shared by everything SourceAnt puts on a screen, from + buttons, fields and modals through to the code graph, diffs and rendered + markdown +- One set of design tokens, published as `@sourceant/design/tokens.css` and as a + Tailwind preset, so a consumer takes the vocabulary rather than restating it +- A check that every path the package advertises actually resolves, run before + anything is published From 01a61bf09afe11a8b727fbdde78434319a13ab3b Mon Sep 17 00:00:00 2001 From: nfebe Date: Sun, 30 Aug 2026 13:17:49 +0100 Subject: [PATCH 3/3] refactor: Release through the shared publish action The publish, changelog and release steps were written here first. They now live in the shared actions, where the next package library takes them without copying. --- .github/workflows/release.yml | 66 +++-------------------------------- 1 file changed, 4 insertions(+), 62 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 256dd7f..9206326 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -2,10 +2,6 @@ name: Release on: workflow_dispatch: - inputs: - version: - description: 'Version to release (e.g., 1.0.0-beta.2)' - required: true push: tags: - 'v*' @@ -18,63 +14,9 @@ jobs: release: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - - - uses: actions/setup-node@v4 - with: - node-version: 22 - registry-url: https://npm.pkg.github.com - scope: '@sourceant' - - - name: Read version from file - id: version - run: echo "version=$(node -p "require('./package.json').version")" >> $GITHUB_OUTPUT - - # The tag and the manifest have to agree, or the package published under - # a tag is not the one that tag names. - - name: Validate version - run: | - FILE_VERSION="$(node -p "require('./package.json').version")" - if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then - RELEASE_VERSION="${{ github.event.inputs.version }}" - else - RELEASE_VERSION="${GITHUB_REF_NAME#v}" - fi - if [ "$RELEASE_VERSION" != "$FILE_VERSION" ]; then - echo "::error::Version mismatch: Input/Tag ($RELEASE_VERSION) != package.json ($FILE_VERSION)" - exit 1 - fi - echo "Version validated: $FILE_VERSION" - - - name: Every export resolves - run: node scripts/check-exports.mjs - - # Read before publishing, because a version published without notes - # cannot be published again to add them. - - name: Release notes from the changelog - run: | - VERSION="${{ steps.version.outputs.version }}" - awk -v version="$VERSION" ' - BEGIN { found=0; printing=0 } - /^## \[/ { - if (found && printing) exit - if ($0 ~ "\\[" version "\\]") { found=1; printing=1; next } - } - found && printing { print } - ' CHANGELOG.md > "${{ runner.temp }}/notes.md" - if [ ! -s "${{ runner.temp }}/notes.md" ]; then - echo "::error::No changelog entry for $VERSION" - exit 1 - fi - - name: Publish - run: npm publish - env: - NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Create Release - uses: softprops/action-gh-release@v2 + uses: whilesmart/workflows/js/publish@main with: - tag_name: v${{ steps.version.outputs.version }} - name: v${{ steps.version.outputs.version }} - body_path: ${{ runner.temp }}/notes.md + token: ${{ secrets.GITHUB_TOKEN }} + scope: '@sourceant' + verify_command: node scripts/check-exports.mjs