Skip to content

Commit df13469

Browse files
committed
chore: implement semantic-release automation for version management and releases
Introduce fully automated release system based on semantic-release Key changes: - Install and configure semantic-release plugins (.releaserc.json) - Migrate GitHub Actions workflow from manual to automated releases - Version determination based on Conventional Commits (feat→minor, fix/ifix/perf→patch) - Auto-generate CHANGELOG.md and migrate historical release notes - Automatically publish to npm and create GitHub Releases from release branch - Add automatic sync from release to main branch - Simplify justfile release command (remove version parameter, merge only) - Add release management guide to CLAUDE.md and README.md - Add ifix commit type for internal fixes
1 parent 58ead98 commit df13469

File tree

6 files changed

+2819
-120
lines changed

6 files changed

+2819
-120
lines changed

.github/workflows/release.yml

Lines changed: 27 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -18,114 +18,56 @@ jobs:
1818
uses: actions/checkout@v5
1919
with:
2020
fetch-depth: 0
21-
22-
- name: Setup Node.js
23-
uses: actions/setup-node@v6
24-
with:
25-
node-version: "20"
21+
persist-credentials: false
2622

2723
- name: Setup pnpm
2824
uses: pnpm/action-setup@v4
2925
with:
3026
version: 9.15.0
3127

28+
- name: Setup Node.js
29+
uses: actions/setup-node@v6
30+
with:
31+
node-version: "22"
32+
3233
- name: Install just
3334
uses: extractions/setup-just@v3
3435

3536
- name: Install dependencies
3637
run: just deps
3738

38-
- name: Get version
39-
id: version
40-
run: |
41-
VERSION=$(node -p "require('./package.json').version")
42-
echo "version=v$VERSION" >> $GITHUB_OUTPUT
43-
echo "version_number=$VERSION" >> $GITHUB_OUTPUT
44-
echo "📦 Version: v$VERSION"
45-
46-
- name: Check if release exists
47-
id: check
48-
run: |
49-
if gh release view "v$(node -p "require('./package.json').version")" &>/dev/null; then
50-
echo "exists=true" >> $GITHUB_OUTPUT
51-
echo "⚠️ Release already exists, skipping"
52-
else
53-
echo "exists=false" >> $GITHUB_OUTPUT
54-
fi
55-
env:
56-
GH_TOKEN: ${{ github.token }}
57-
58-
- name: Build extension
59-
if: steps.check.outputs.exists == 'false'
39+
- name: Build and package
6040
run: just package
6141

62-
- name: Generate changelog
63-
id: changelog
64-
if: steps.check.outputs.exists == 'false'
42+
- name: Configure Git
6543
run: |
66-
CURRENT="v$(node -p "require('./package.json').version")"
67-
PREVIOUS=$(git tag --sort=-v:refname | grep -v "$CURRENT" | head -1 || echo "")
44+
git config --global user.name "github-actions[bot]"
45+
git config --global user.email "github-actions[bot]@users.noreply.github.com"
6846
69-
if [ -z "$PREVIOUS" ]; then
70-
echo "changelog=Initial release of quick command buttons extension" >> $GITHUB_OUTPUT
71-
else
72-
CHANGELOG=$(git log $PREVIOUS..HEAD --pretty=format:"- %s" --no-merges)
73-
echo "changelog<<EOF" >> $GITHUB_OUTPUT
74-
echo "$CHANGELOG" >> $GITHUB_OUTPUT
75-
echo "EOF" >> $GITHUB_OUTPUT
76-
fi
77-
78-
- name: Create GitHub Release
79-
if: steps.check.outputs.exists == 'false'
80-
uses: softprops/action-gh-release@v2
81-
with:
82-
tag_name: ${{ steps.version.outputs.version }}
83-
name: ${{ steps.version.outputs.version }}
84-
body: |
85-
## 🎉 What's New in ${{ steps.version.outputs.version }}
86-
87-
${{ steps.changelog.outputs.changelog }}
88-
files: |
89-
quick-command-buttons-${{ steps.version.outputs.version_number }}.vsix
90-
generate_release_notes: true
47+
- name: Run semantic-release
48+
run: npx semantic-release
9149
env:
92-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
50+
GITHUB_TOKEN: ${{ secrets.PAT_TOKEN }}
51+
GIT_AUTHOR_NAME: "github-actions[bot]"
52+
GIT_AUTHOR_EMAIL: "github-actions[bot]@users.noreply.github.com"
53+
GIT_COMMITTER_NAME: "github-actions[bot]"
54+
GIT_COMMITTER_EMAIL: "github-actions[bot]@users.noreply.github.com"
55+
HUSKY: 0
9356

9457
- name: Publish to marketplaces
95-
if: steps.check.outputs.exists == 'false'
9658
run: just publish both
9759
env:
9860
VSCE_ACCESS_TOKEN: ${{ secrets.VSCE_PAT }}
9961
OVSX_ACCESS_TOKEN: ${{ secrets.OVSX_PAT }}
10062

101-
- name: Update release with success status
102-
if: success() && steps.check.outputs.exists == 'false'
103-
run: |
104-
TIMESTAMP=$(date -u +"%Y-%m-%d %H:%M:%S UTC")
105-
gh release view "${{ steps.version.outputs.version }}" --json body -q .body > body.txt
106-
echo "" >> body.txt
107-
echo "---" >> body.txt
108-
echo "" >> body.txt
109-
echo "✅ **Successfully published to both marketplaces!**" >> body.txt
110-
echo "" >> body.txt
111-
echo "- VSCode Marketplace: https://marketplace.visualstudio.com/items?itemName=KubrickCode.quick-command-buttons" >> body.txt
112-
echo "- Open VSX Registry: https://open-vsx.org/extension/KubrickCode/quick-command-buttons" >> body.txt
113-
echo "" >> body.txt
114-
echo "🕐 Published at: $TIMESTAMP" >> body.txt
115-
gh release edit "${{ steps.version.outputs.version }}" --notes-file body.txt
116-
env:
117-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
118-
119-
- name: Update release on failure
120-
if: failure() && steps.check.outputs.exists == 'false'
63+
- name: Sync release to main
12164
run: |
122-
gh release view "${{ steps.version.outputs.version }}" --json body -q .body > body.txt
123-
echo "" >> body.txt
124-
echo "---" >> body.txt
125-
echo "" >> body.txt
126-
echo "❌ **Marketplace publishing failed!**" >> body.txt
127-
echo "" >> body.txt
128-
echo "Please check the GitHub Actions logs for details." >> body.txt
129-
gh release edit "${{ steps.version.outputs.version }}" --notes-file body.txt
65+
git config user.name "github-actions[bot]"
66+
git config user.email "github-actions[bot]@users.noreply.github.com"
67+
git fetch origin release
68+
git fetch origin main
69+
git checkout main
70+
git merge origin/release --no-edit
71+
git push https://x-access-token:${GITHUB_TOKEN}@github.com/${{ github.repository }}.git main
13072
env:
131-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
73+
GITHUB_TOKEN: ${{ secrets.PAT_TOKEN }}

.releaserc.json

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
{
2+
"branches": ["release"],
3+
"plugins": [
4+
[
5+
"@semantic-release/commit-analyzer",
6+
{
7+
"preset": "conventionalcommits",
8+
"releaseRules": [
9+
{ "type": "feat", "release": "minor" },
10+
{ "type": "fix", "release": "patch" },
11+
{ "type": "perf", "release": "patch" },
12+
{ "type": "ifix", "release": "patch" },
13+
{ "type": "docs", "release": "patch" },
14+
{ "type": "style", "release": "patch" },
15+
{ "type": "refactor", "release": "patch" },
16+
{ "type": "test", "release": "patch" },
17+
{ "type": "ci", "release": "patch" },
18+
{ "type": "chore", "release": "patch" }
19+
]
20+
}
21+
],
22+
[
23+
"@semantic-release/release-notes-generator",
24+
{
25+
"preset": "conventionalcommits",
26+
"presetConfig": {
27+
"types": [
28+
{ "type": "feat", "section": "✨ Features" },
29+
{ "type": "fix", "section": "🐛 Bug Fixes" },
30+
{ "type": "perf", "section": "⚡ Performance" },
31+
{ "type": "ifix", "section": "🔧 Internal Fixes" },
32+
{ "type": "docs", "section": "📝 Documentation" },
33+
{ "type": "style", "section": "💄 Styling" },
34+
{ "type": "refactor", "section": "♻️ Refactoring" },
35+
{ "type": "test", "section": "✅ Tests" },
36+
{ "type": "ci", "section": "👷 CI/CD" },
37+
{ "type": "chore", "section": "🔨 Chores" }
38+
]
39+
}
40+
}
41+
],
42+
[
43+
"@semantic-release/changelog",
44+
{
45+
"changelogFile": "CHANGELOG.md"
46+
}
47+
],
48+
[
49+
"@semantic-release/npm",
50+
{
51+
"npmPublish": false
52+
}
53+
],
54+
[
55+
"@semantic-release/exec",
56+
{
57+
"prepareCmd": "just lint"
58+
}
59+
],
60+
[
61+
"@semantic-release/git",
62+
{
63+
"assets": ["package.json", "CHANGELOG.md"],
64+
"message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
65+
}
66+
],
67+
[
68+
"@semantic-release/github",
69+
{
70+
"assets": [
71+
{
72+
"path": "quick-command-buttons-*.vsix",
73+
"label": "VS Code Extension Package"
74+
}
75+
]
76+
}
77+
]
78+
]
79+
}

CHANGELOG.md

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
# Changelog
2+
3+
All notable changes to the "Quick Command Buttons" extension will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7+
8+
## [0.2.10](https://github.com/KubrickCode/quick-command-buttons/compare/v0.2.9...v0.2.10) (2025-01-15)
9+
10+
### 🐛 Bug Fixes
11+
12+
- Fix same-command buttons sharing terminal
13+
- Fix missing terminalName input in group command UI
14+
- Fix CI test workflow just command
15+
- Fixed an issue where commands could be run in the same terminal if the terminal name was the same
16+
- Fixed a docker-in-docker build failure due to moby-cli lack in Debian trixie
17+
18+
### ✨ Features
19+
20+
- Remove default name values for new commands
21+
- Remove unnecessary degit package
22+
23+
### 🔨 Chores
24+
25+
- build(deps-dev): bump vite
26+
- build(deps): bump actions/setup-node from 5 to 6
27+
- build(deps): bump softprops/action-gh-release from 1 to 2
28+
- build(deps): bump extractions/setup-just from 2 to 3
29+
- build(deps): bump actions/checkout from 4 to 5
30+
- Change Discord notification language
31+
- Modify environment variables configuration
32+
- Edit Contributing section to README
33+
- Sync workflow configurations
34+
- Sync container configurations
35+
- Sync AI agent configurations
36+
37+
## [0.2.9](https://github.com/KubrickCode/quick-command-buttons/compare/v0.2.7...v0.2.9) (2024-12-30)
38+
39+
### ✨ Features
40+
41+
- Add release workflow
42+
- Add ovsx in root package
43+
- Add funding
44+
- Sync README basic configuration example with package.json defaults
45+
46+
### 🔨 Chores
47+
48+
- build(deps): bump actions/setup-node from 4 to 5
49+
- build(deps): bump actions/checkout from 4 to 5
50+
- build(deps): bump codecov/codecov-action from 3 to 5
51+
- build(deps): bump tar-fs in the npm_and_yarn group
52+
- build(deps-dev): bump @vscode/vsce from 3.0.0 to 3.6.2
53+
- Sync PR automation from general
54+
- Add dependabot & issue/PR automation workflows
55+
56+
## [0.2.7](https://github.com/KubrickCode/quick-command-buttons/compare/v0.2.6...v0.2.7) (2024-12-15)
57+
58+
### 🐛 Bug Fixes
59+
60+
- Fix shortcut key matching to handle whitespace in input
61+
62+
## [0.2.6](https://github.com/KubrickCode/quick-command-buttons/compare/v0.2.4...v0.2.6) (2024-12-10)
63+
64+
### ✨ Features
65+
66+
- Exclude dev dependencies from VSIX package
67+
- Replace pinyin with tiny-pinyin for 99.83% size reduction
68+
69+
## [0.2.4](https://github.com/KubrickCode/quick-command-buttons/compare/v0.2.2...v0.2.4) (2024-12-05)
70+
71+
### ✨ Features
72+
73+
- Refactor extension packaging workflow to use root directory
74+
- Add keyboard layout converter module with 15 language support
75+
- Modify out path and vscodeignore policy
76+
- Optimize deployment pipeline and clean up artifacts
77+
78+
### 📝 Documentation
79+
80+
- Add CODING_GUIDE.md
81+
82+
## [0.2.2](https://github.com/KubrickCode/quick-command-buttons/compare/v0.2.0...v0.2.2) (2024-11-28)
83+
84+
### 🐛 Bug Fixes
85+
86+
- Fix modal backdrop clipping issue in webview environment
87+
- Improve shortcut input layout and placeholder visibility
88+
89+
### ✨ Features
90+
91+
- Add workspace vs global configuration scope guidance
92+
- Add claude command and configurations
93+
- Add MCP configuration
94+
- Add gemini configuration
95+
- Add degit command
96+
97+
### 📝 Documentation
98+
99+
- Keyword enhancement
100+
101+
## [0.2.0](https://github.com/KubrickCode/quick-command-buttons/compare/v0.1.6...v0.2.0) (2024-11-15)
102+
103+
### ✨ Features
104+
105+
- Initial release with core functionality
106+
- Customizable command buttons in status bar
107+
- Support for infinite nesting of command groups
108+
- React-based visual configuration UI
109+
- Multi-language keyboard layout support
110+
- Workspace and global configuration scopes

justfile

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,15 +81,23 @@ publish target="both":
8181
fi
8282
fi
8383

84-
release version="patch":
85-
@echo "🚀 Creating {{ version }} release..."
86-
npm version {{ version }}
87-
git push origin main --tags
84+
release:
85+
@echo "🚀 Starting release process..."
86+
@echo "📦 Merging main to release branch..."
8887
git checkout release
8988
git merge main
9089
git push origin release
9190
git checkout main
92-
@echo "✅ Release complete! Check GitHub Actions."
91+
@echo ""
92+
@echo "✅ Release branch updated!"
93+
@echo "🔄 GitHub Actions will now:"
94+
@echo " 1. Analyze commits for version bump"
95+
@echo " 2. Generate release notes"
96+
@echo " 3. Create tag and GitHub release"
97+
@echo " 4. Update CHANGELOG.md"
98+
@echo " 5. Build and upload to VS Code Marketplace"
99+
@echo ""
100+
@echo "📊 Check progress: https://github.com/KubrickCode/quick-command-buttons/actions"
93101

94102
run-view:
95103
cd "{{ web_view_dir }}" && pnpm dev

package.json

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -269,10 +269,19 @@
269269
"ovsx-publish": "ovsx publish"
270270
},
271271
"devDependencies": {
272+
"@semantic-release/changelog": "6.0.3",
273+
"@semantic-release/commit-analyzer": "13.0.0",
274+
"@semantic-release/exec": "7.1.0",
275+
"@semantic-release/git": "10.0.1",
276+
"@semantic-release/github": "11.0.1",
277+
"@semantic-release/npm": "13.1.2",
278+
"@semantic-release/release-notes-generator": "14.0.1",
272279
"@vscode/vsce": "3.6.2",
280+
"conventional-changelog-conventionalcommits": "8.0.0",
281+
"husky": "9.1.7",
282+
"lint-staged": "15.2.11",
273283
"ovsx": "0.10.6",
274284
"prettier": "3.6.2",
275-
"husky": "9.1.7",
276-
"lint-staged": "15.2.11"
285+
"semantic-release": "24.2.0"
277286
}
278287
}

0 commit comments

Comments
 (0)