Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -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": []
}
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
branches: [develop, main]
push:
branches: [main]
workflow_call: {}

concurrency:
group: ${{ github.workflow }}-${{ github.ref || github.run_id }}
Expand Down
67 changes: 67 additions & 0 deletions .github/workflows/release-prepare.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
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
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- 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}`);
}
Original file line number Diff line number Diff line change
@@ -1,42 +1,44 @@
name: Release
name: Release Publish

on:
push:
branches: [main]

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"
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@

### Patch Changes

- [`40c75eb`](https://github.com/addon-stack/storage/commit/40c75ebeaa8960e5d7f483a84ddae24b7a347f03) Thanks [@addon-stack](https://github.com/addon-stack)! - Fix pipeline
- [`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

Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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}": [
Expand Down