Skip to content

Commit b3fb231

Browse files
alerizzoclaude
andcommitted
feat: adopt changesets for automated versioning and publishing
Replace the manual version bump + GitHub release trigger workflow with changesets, so version bumps and npm publishing are handled automatically via a "Version Packages" PR. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent f662eef commit b3fb231

7 files changed

Lines changed: 1658 additions & 104 deletions

File tree

.changeset/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Changesets
2+
3+
Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
4+
with multi-package repos, or single-package repos to help you version and publish your code. You can
5+
find the full documentation for it [in our repository](https://github.com/changesets/changesets).
6+
7+
We have a quick list of common questions to get you started engaging with this project in
8+
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md).

.changeset/config.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"$schema": "https://unpkg.com/@changesets/config@3.1.3/schema.json",
3+
"changelog": [
4+
"@changesets/changelog-github",
5+
{ "repo": "codacy/codacy-cloud-cli" }
6+
],
7+
"commit": false,
8+
"fixed": [],
9+
"linked": [],
10+
"access": "public",
11+
"baseBranch": "main",
12+
"updateInternalDependencies": "patch",
13+
"ignore": []
14+
}

.github/workflows/ci.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,25 @@ jobs:
3737

3838
- name: Test
3939
run: npm test
40+
41+
changeset-check:
42+
if: github.event_name == 'pull_request'
43+
runs-on: ubuntu-latest
44+
45+
steps:
46+
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
47+
with:
48+
fetch-depth: 0
49+
50+
- name: Check for changesets
51+
run: |
52+
# Count .changeset/*.md files added/modified in this PR compared to the base branch
53+
CHANGESETS=$(git diff --name-only origin/${{ github.base_ref }}...HEAD -- '.changeset/*.md' ':!.changeset/README.md' | wc -l)
54+
if [ "$CHANGESETS" -eq 0 ]; then
55+
echo "::error::No changeset found for this PR. Run 'npx changeset' to describe your changes."
56+
echo ""
57+
echo "If this PR does not require a version bump (e.g., docs-only or CI changes),"
58+
echo "add an empty changeset with: npx changeset --empty"
59+
exit 1
60+
fi
61+
echo "Found $CHANGESETS changeset file(s) changed in this PR."

.github/workflows/publish.yml

Lines changed: 0 additions & 40 deletions
This file was deleted.

.github/workflows/release.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
branches: [main]
6+
7+
concurrency:
8+
group: release-${{ github.ref }}
9+
cancel-in-progress: false
10+
11+
permissions:
12+
contents: write
13+
pull-requests: write
14+
id-token: write
15+
16+
jobs:
17+
release:
18+
runs-on: ubuntu-latest
19+
20+
steps:
21+
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
22+
23+
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
24+
with:
25+
node-version: 22
26+
cache: npm
27+
registry-url: "https://registry.npmjs.org"
28+
29+
- name: Install dependencies
30+
run: npm ci
31+
32+
- name: Generate API client
33+
run: npm run update-api
34+
35+
- name: Build
36+
run: npm run build
37+
38+
- name: Create Release PR or Publish
39+
uses: changesets/action@6a0a831ff30acef54f2c6aa1cbbc1096b066edaf # v1
40+
with:
41+
publish: npm run release
42+
title: "chore: version packages"
43+
commit: "chore: version packages"
44+
env:
45+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
46+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

0 commit comments

Comments
 (0)