From 0a608f85bd8ec31cfd3a6fc4bddf905977a96b64 Mon Sep 17 00:00:00 2001 From: Ryan Seddon Date: Wed, 25 Feb 2026 21:41:40 +1100 Subject: [PATCH 1/4] feat: make changeset file trigger release pr --- .github/workflows/release.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7a266f3..8c04648 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -14,12 +14,24 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + with: + fetch-depth: 0 + token: ${{ secrets.GITHUB_TOKEN }} - uses: actions/setup-node@v4 with: node-version: 22 cache: 'npm' + registry-url: 'https://registry.npmjs.org' - run: npm install - run: npm run release + - name: Commit version bump + run: | + git config --local user.email "github-actions[bot]@users.noreply.github.com" + git config --local user.name "github-actions[bot]" + git add -A + git commit -m "chore: version bump" || echo "No version change" + - name: Push changes + run: git push - name: Publish to npm run: npm run publish:changesets env: From 1efde9901b8e93c43f6268f12fe8c9ee61f88a74 Mon Sep 17 00:00:00 2001 From: Ryan Seddon Date: Thu, 26 Feb 2026 10:16:07 +1100 Subject: [PATCH 2/4] fix: only run release when changeset present or version changed --- .github/workflows/release.yml | 46 ++++++++++++++++++++++++++++++----- 1 file changed, 40 insertions(+), 6 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8c04648..661ed07 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -23,16 +23,50 @@ jobs: cache: 'npm' registry-url: 'https://registry.npmjs.org' - run: npm install - - run: npm run release - - name: Commit version bump + - name: Check for changes or version bump + id: check run: | + # Check if there are changeset files or if version changed + HAS_CHANGESET=false + HAS_VERSION_CHANGE=false + + if [ -f ".changeset/"* ]; then + HAS_CHANGESET=true + fi + + # Get current version from package.json + CURRENT_VERSION=$(node -p "require('./package.json').version") + + # Check if version in package.json differs from latest tag + git fetch --tags + LATEST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "") + if [ -n "$LATEST_TAG" ]; then + TAG_VERSION=${LATEST_TAG#v} + if [ "$CURRENT_VERSION" != "$TAG_VERSION" ]; then + HAS_VERSION_CHANGE=true + fi + elif [ "$CURRENT_VERSION" != "0.0.0" ]; then + HAS_VERSION_CHANGE=true + fi + + echo "has-changeset=$HAS_CHANGESET" >> $GITHUB_OUTPUT + echo "has-version-change=$HAS_VERSION_CHANGE" >> $GITHUB_OUTPUT + echo "Current version: $CURRENT_VERSION, Latest tag: $LATEST_TAG" + + if [ "$HAS_CHANGESET" = "false" ] && [ "$HAS_VERSION_CHANGE" = "false" ]; then + echo "No changeset or version change - skipping release" + else + echo "Changeset or version change detected - proceeding with release" + fi + - name: Version and publish + if: steps.check.outputs.has-changeset == 'true' || steps.check.outputs.has-version-change == 'true' + run: | + npm run release git config --local user.email "github-actions[bot]@users.noreply.github.com" git config --local user.name "github-actions[bot]" git add -A git commit -m "chore: version bump" || echo "No version change" - - name: Push changes - run: git push - - name: Publish to npm - run: npm run publish:changesets + git push + npm run publish:changesets env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From ff8ed5a54c6876322ab274c266338940c78d9656 Mon Sep 17 00:00:00 2001 From: Ryan Seddon Date: Thu, 26 Feb 2026 10:32:16 +1100 Subject: [PATCH 3/4] chore: use official changesets/action for releases - Simplify release workflow to use changesets/action - Uses trusted publishers (no NPM_TOKEN needed) - Removes manual changeset check (action handles it) --- .github/workflows/ci.yml | 12 ------- .github/workflows/release.yml | 68 ++++++++--------------------------- 2 files changed, 15 insertions(+), 65 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 86922f0..9fe239b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -34,15 +34,3 @@ jobs: cache: 'npm' - run: npm install - run: npm run build - - changeset: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: Check for changeset - run: | - if [ ! -f ".changeset/"* ]; then - echo "::warning::No changeset found. Consider adding one using 'npx changeset'" - else - echo "Changeset found ✓" - fi diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 661ed07..5f68d53 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -5,68 +5,30 @@ on: branches: - main -permissions: - id-token: write - contents: read +concurrency: ${{ github.workflow }}-${{ github.ref }} jobs: release: + name: Release runs-on: ubuntu-latest + permissions: + contents: write steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - token: ${{ secrets.GITHUB_TOKEN }} - - uses: actions/setup-node@v4 + - name: Checkout Repo + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 with: node-version: 22 cache: 'npm' - registry-url: 'https://registry.npmjs.org' - - run: npm install - - name: Check for changes or version bump - id: check - run: | - # Check if there are changeset files or if version changed - HAS_CHANGESET=false - HAS_VERSION_CHANGE=false - - if [ -f ".changeset/"* ]; then - HAS_CHANGESET=true - fi - # Get current version from package.json - CURRENT_VERSION=$(node -p "require('./package.json').version") + - name: Install Dependencies + run: npm install - # Check if version in package.json differs from latest tag - git fetch --tags - LATEST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "") - if [ -n "$LATEST_TAG" ]; then - TAG_VERSION=${LATEST_TAG#v} - if [ "$CURRENT_VERSION" != "$TAG_VERSION" ]; then - HAS_VERSION_CHANGE=true - fi - elif [ "$CURRENT_VERSION" != "0.0.0" ]; then - HAS_VERSION_CHANGE=true - fi - - echo "has-changeset=$HAS_CHANGESET" >> $GITHUB_OUTPUT - echo "has-version-change=$HAS_VERSION_CHANGE" >> $GITHUB_OUTPUT - echo "Current version: $CURRENT_VERSION, Latest tag: $LATEST_TAG" - - if [ "$HAS_CHANGESET" = "false" ] && [ "$HAS_VERSION_CHANGE" = "false" ]; then - echo "No changeset or version change - skipping release" - else - echo "Changeset or version change detected - proceeding with release" - fi - - name: Version and publish - if: steps.check.outputs.has-changeset == 'true' || steps.check.outputs.has-version-change == 'true' - run: | - npm run release - git config --local user.email "github-actions[bot]@users.noreply.github.com" - git config --local user.name "github-actions[bot]" - git add -A - git commit -m "chore: version bump" || echo "No version change" - git push - npm run publish:changesets + - name: Create Release Pull Request + uses: changesets/action@v1 + with: + publish: npm run publish:changesets env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From a302f46e3d691a6d32ae3e759df216e0eea0dabc Mon Sep 17 00:00:00 2001 From: Ryan Seddon Date: Thu, 26 Feb 2026 10:34:48 +1100 Subject: [PATCH 4/4] fix: add id-token for npm trusted publishers --- .github/workflows/release.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 5f68d53..47a5b50 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -13,6 +13,7 @@ jobs: runs-on: ubuntu-latest permissions: contents: write + id-token: write steps: - name: Checkout Repo uses: actions/checkout@v4 @@ -22,6 +23,7 @@ jobs: with: node-version: 22 cache: 'npm' + registry-url: 'https://registry.npmjs.org' - name: Install Dependencies run: npm install