From be7bc5fa7c4302edfedc7fc6865129df302719fb Mon Sep 17 00:00:00 2001 From: Addon Stack Date: Sat, 20 Sep 2025 18:53:05 +0300 Subject: [PATCH 1/4] chore: configure workflows for release preparation and publishing - Added `release-prepare.yml` to automate versioning and changelog generation with Changesets. - Renamed and updated `release.yml` to `release-publish.yml` for npm publishing. - Enhanced `ci.yml` workflow with support for workflow calls. - Updated Changesets configuration and added `release` script in `package.json`. --- .changeset/config.json | 8 ++- .github/workflows/ci.yml | 1 + .github/workflows/release-prepare.yml | 66 +++++++++++++++++++ .../{release.yml => release-publish.yml} | 30 +++++---- package.json | 3 +- 5 files changed, 91 insertions(+), 17 deletions(-) create mode 100644 .github/workflows/release-prepare.yml rename .github/workflows/{release.yml => release-publish.yml} (61%) diff --git a/.changeset/config.json b/.changeset/config.json index ec48809..65d46d4 100644 --- a/.changeset/config.json +++ b/.changeset/config.json @@ -1,10 +1,14 @@ { - "$schema": "https://unpkg.com/@changesets/config/schema.json", + "$schema": "https://unpkg.com/@changesets/config@2.3.1/schema.json", "changelog": [ "@changesets/changelog-github", { "repo": "addon-stack/storage" } ], "commit": false, + "fixed": [], + "linked": [], "access": "public", - "baseBranch": "main" + "baseBranch": "main", + "updateInternalDependencies": "patch", + "ignore": [] } diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 06786b2..c32bfea 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,6 +5,7 @@ on: branches: [develop, main] push: branches: [main] + workflow_call: {} concurrency: group: ${{ github.workflow }}-${{ github.ref || github.run_id }} diff --git a/.github/workflows/release-prepare.yml b/.github/workflows/release-prepare.yml new file mode 100644 index 0000000..f40aa1e --- /dev/null +++ b/.github/workflows/release-prepare.yml @@ -0,0 +1,66 @@ +name: Release Prepare + +on: + push: + branches: + - 'release/*' + +permissions: + contents: write + pull-requests: write + +jobs: + ci: + uses: ./.github/workflows/ci.yml + secrets: inherit + + prepare: + name: Prepare release with Changesets (version + changelog) + runs-on: ubuntu-latest + needs: ci + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: 20 + cache: npm + + - name: Install dependencies + run: npm ci + + - name: Generate versions & changelog (changeset version) + run: npx changeset version + env: + HUSKY: 0 + + - name: Commit version & changelog changes + uses: stefanzweifel/git-auto-commit-action@v5 + with: + commit_message: "chore: version packages (prepare release)" + commit_user_name: github-actions[bot] + commit_user_email: 41898282+github-actions[bot]@users.noreply.github.com + + - name: Open or update PR to main + uses: actions/github-script@v7 + with: + script: | + const { owner, repo } = context.repo; + const head = context.ref.replace('refs/heads/', ''); + const base = 'main'; + const title = 'chore: release (prepared by Changesets)'; + const body = 'This PR was automatically created by release-prepare workflow. It contains version bumps and CHANGELOG updates generated by Changesets.'; + + const existing = await github.rest.pulls.list({ owner, repo, state: 'open', head: `${owner}:${head}`, base }); + if (existing.data.length > 0) { + const pr = existing.data[0]; + await github.rest.pulls.update({ owner, repo, pull_number: pr.number, title, body }); + core.info(`Updated PR #${pr.number}: ${pr.html_url}`); + } else { + const pr = await github.rest.pulls.create({ owner, repo, head, base, title, body }); + core.info(`Created PR #${pr.data.number}: ${pr.data.html_url}`); + } diff --git a/.github/workflows/release.yml b/.github/workflows/release-publish.yml similarity index 61% rename from .github/workflows/release.yml rename to .github/workflows/release-publish.yml index 612290a..154a1b2 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release-publish.yml @@ -1,4 +1,4 @@ -name: Release +name: Release Publish on: push: @@ -6,37 +6,39 @@ on: permissions: contents: write - id-token: write pull-requests: write + id-token: write jobs: - release: + ci: + uses: ./.github/workflows/ci.yml + secrets: inherit + + publish: + name: Publish to npm via Changesets runs-on: ubuntu-latest + needs: ci steps: - name: Checkout uses: actions/checkout@v4 - with: - fetch-depth: 0 - - name: Setup Node + - name: Setup Node.js uses: actions/setup-node@v4 with: node-version: 20 - registry-url: https://registry.npmjs.org cache: npm + registry-url: https://registry.npmjs.org - - name: Install + - name: Install dependencies run: npm ci - - name: Build - run: npm run build - - name: Create Release PR or Publish to npm uses: changesets/action@v1 with: - publish: npm publish --provenance --access public + publish: npm run release createGithubReleases: true + commitMode: github-api env: - HUSKY: 0 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + NPM_CONFIG_PROVENANCE: "true" diff --git a/package.json b/package.json index eb1df94..1d84e97 100644 --- a/package.json +++ b/package.json @@ -32,7 +32,8 @@ "test": "jest", "test:run": "jest --ci --passWithNoTests", "test:related": "jest --bail --passWithNoTests --findRelatedTests", - "typecheck": "tsc -p tsconfig.json --noEmit" + "typecheck": "tsc -p tsconfig.json --noEmit", + "release": "changeset publish" }, "lint-staged": { "*.{ts,tsx,js,jsx}": [ From 141636ed6a518371d47d9617b1e62d7cc239fc39 Mon Sep 17 00:00:00 2001 From: Addon Stack Date: Sat, 20 Sep 2025 18:55:43 +0300 Subject: [PATCH 2/4] chore: add changeset doc --- .changeset/stupid-walls-punch.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.changeset/stupid-walls-punch.md b/.changeset/stupid-walls-punch.md index ce737fe..d8b00bb 100644 --- a/.changeset/stupid-walls-punch.md +++ b/.changeset/stupid-walls-punch.md @@ -2,4 +2,9 @@ "@addon-core/storage": patch --- -Fix pipeline +### Configure workflows for release preparation and publishing + +- Added `release-prepare.yml` to automate versioning and changelog generation with Changesets. +- Renamed and updated `release.yml` to `release-publish.yml` for npm publishing. +- Enhanced `ci.yml` workflow with support for workflow calls. +- Updated Changesets configuration and added `release` script in `package.json`. From 19287d0cf50232cbef58d6c0f19172ca6f492180 Mon Sep 17 00:00:00 2001 From: Addon Stack Date: Sat, 20 Sep 2025 22:06:11 +0300 Subject: [PATCH 3/4] chore: add GITHUB_TOKEN to release-prepare workflow --- .github/workflows/release-prepare.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/release-prepare.yml b/.github/workflows/release-prepare.yml index f40aa1e..dd247e5 100644 --- a/.github/workflows/release-prepare.yml +++ b/.github/workflows/release-prepare.yml @@ -37,6 +37,7 @@ jobs: run: npx changeset version env: HUSKY: 0 + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Commit version & changelog changes uses: stefanzweifel/git-auto-commit-action@v5 From 4a0f17e3e5cad1f8bda704b959c70d909adfe70c Mon Sep 17 00:00:00 2001 From: addon-stack <191148085+addon-stack@users.noreply.github.com> Date: Sat, 20 Sep 2025 19:07:14 +0000 Subject: [PATCH 4/4] chore: version packages (prepare release) --- .changeset/stupid-walls-punch.md | 10 ---------- CHANGELOG.md | 10 ++++++++++ package.json | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-) delete mode 100644 .changeset/stupid-walls-punch.md diff --git a/.changeset/stupid-walls-punch.md b/.changeset/stupid-walls-punch.md deleted file mode 100644 index d8b00bb..0000000 --- a/.changeset/stupid-walls-punch.md +++ /dev/null @@ -1,10 +0,0 @@ ---- -"@addon-core/storage": patch ---- - -### Configure workflows for release preparation and publishing - -- Added `release-prepare.yml` to automate versioning and changelog generation with Changesets. -- Renamed and updated `release.yml` to `release-publish.yml` for npm publishing. -- Enhanced `ci.yml` workflow with support for workflow calls. -- Updated Changesets configuration and added `release` script in `package.json`. diff --git a/CHANGELOG.md b/CHANGELOG.md index b3495d1..b45f3a5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,15 @@ # @addon-core/storage +## 0.1.2 + +### Patch Changes + +- [`40c75eb`](https://github.com/addon-stack/storage/commit/40c75ebeaa8960e5d7f483a84ddae24b7a347f03) Thanks [@addon-stack](https://github.com/addon-stack)! - ### Configure workflows for release preparation and publishing + - Added `release-prepare.yml` to automate versioning and changelog generation with Changesets. + - Renamed and updated `release.yml` to `release-publish.yml` for npm publishing. + - Enhanced `ci.yml` workflow with support for workflow calls. + - Updated Changesets configuration and added `release` script in `package.json`. + ## 0.1.1 ### Patch Changes diff --git a/package.json b/package.json index 1d84e97..8a11be4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@addon-core/storage", - "version": "0.1.1", + "version": "0.1.2", "type": "module", "repository": { "type": "git",