release-suite 0.1.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -18,12 +18,11 @@ jobs:
18
18
  release-pr:
19
19
  # Only runs when:
20
20
  # - The PR has been merged
21
- # - And the branch is NOT release/v/*
21
+ # - The PR does NOT have the "release" label
22
22
  if: >
23
23
  github.event.pull_request.merged == true &&
24
- !startsWith(github.event.pull_request.head.ref, 'release/v/')
24
+ !contains(join(github.event.pull_request.labels.*.name, ','), 'release')
25
25
  runs-on: ubuntu-latest
26
-
27
26
  steps:
28
27
  - uses: actions/checkout@v4
29
28
  with:
@@ -48,40 +47,58 @@ jobs:
48
47
  run: npm ci
49
48
 
50
49
  - name: Install release-suite locally (self usage)
51
- run: npm install .
50
+ run: npm install .
52
51
 
53
52
  # Compute next version to release
54
53
  - name: Compute next version
55
- id: semver
54
+ id: compute
56
55
  run: |
57
- VERSION=$(rs-compute-version || echo "")
58
- echo "version=$VERSION" >> $GITHUB_OUTPUT
56
+ set +e
57
+ RESULT=$(node bin/compute-version.js --ci --json)
58
+ STATUS=$?
59
+ VERSION=$(echo "$RESULT" | jq -r '.nextVersion // empty')
59
60
 
60
- - name: Stop if no release needed
61
- if: steps.semver.outputs.version == ''
62
- run: exit 0
61
+ echo "$RESULT"
62
+ echo "status=$STATUS" >> $GITHUB_OUTPUT
63
+ echo "version=$VERSION" >> $GITHUB_OUTPUT
63
64
 
64
65
  - name: Bump package.json
65
- run: npm version ${{ steps.semver.outputs.version }} --no-git-tag-version
66
+ if: steps.compute.outputs.status == '0' && steps.compute.outputs.version != ''
67
+ run: npm version ${{ steps.compute.outputs.version }} --no-git-tag-version
66
68
 
67
69
  - name: Build
68
70
  run: npm run build --if-present
69
71
 
70
72
  - name: Generate changelog
71
- run: rs-generate-changelog
73
+ if: steps.compute.outputs.status == '0' && steps.compute.outputs.version != ''
74
+ run: node bin/generate-changelog.js
75
+
76
+ - name: Detect dist directory
77
+ id: dist
78
+ run: |
79
+ if [ -d dist ]; then
80
+ echo "exists=true" >> "$GITHUB_OUTPUT"
81
+ else
82
+ echo "exists=false" >> "$GITHUB_OUTPUT"
83
+ fi
84
+
85
+ - name: Stage dist if exists
86
+ if: steps.dist.outputs.exists == 'true'
87
+ run: git add dist
72
88
 
73
89
  # Automatically create branches, commits, and PRs with peter-evans
74
90
  - name: Create Release PR
91
+ if: steps.compute.outputs.status == '0' && steps.compute.outputs.version != ''
75
92
  uses: peter-evans/create-pull-request@v6
76
93
  with:
77
94
  token: ${{ secrets.GITHUB_TOKEN }}
78
- commit-message: ":bricks: chore(release): prepare version ${{ steps.semver.outputs.version }} [skip ci]"
79
- branch: release/v/${{ steps.semver.outputs.version }}
80
- title: ":bricks: chore(release): ${{ steps.semver.outputs.version }}"
95
+ commit-message: ":bricks: chore(release): prepare version ${{ steps.compute.outputs.version }} [skip ci]"
96
+ branch: release/${{ steps.compute.outputs.version }}
97
+ title: ":bricks: chore(release): ${{ steps.compute.outputs.version }}"
81
98
  body: |
82
99
  This PR contains the release artifacts:
83
100
 
84
- - Updated `package.json` and `package-lock.json` with version ${{ steps.semver.outputs.version }}
101
+ - Updated `package.json` and `package-lock.json` with version ${{ steps.compute.outputs.version }}
85
102
  - Updated `CHANGELOG.md` with latest changes
86
103
  - Generated `/dist` directory with build files (if applicable)
87
104
 
@@ -91,4 +108,3 @@ jobs:
91
108
  add-paths: |
92
109
  package.json
93
110
  CHANGELOG.md
94
- dist/**
@@ -1,8 +1,7 @@
1
1
  name: Publish Release
2
2
 
3
3
  on:
4
- pull_request:
5
- types: [closed]
4
+ push:
6
5
  branches:
7
6
  - main
8
7
 
@@ -19,13 +18,10 @@ concurrency:
19
18
  jobs:
20
19
  publish:
21
20
  # Only runs when:
22
- # - The PR has been merged
23
- # - And the branch is release/v/*
21
+ # - The commit message starts with ":bricks: chore(release):"
24
22
  if: >
25
- github.event.pull_request.merged == true &&
26
- startsWith(github.event.pull_request.head.ref, 'release/v/')
23
+ startsWith(github.event.head_commit.message, ':bricks: chore(release):')
27
24
  runs-on: ubuntu-latest
28
-
29
25
  steps:
30
26
  - name: Checkout repository
31
27
  uses: actions/checkout@v4
@@ -44,30 +40,44 @@ jobs:
44
40
  - name: Install release-suite locally (self usage)
45
41
  run: npm install .
46
42
 
47
- - name: Build
48
- run: npm run build --if-present
49
-
50
43
  - name: Create Git Tag
51
- run: rs-create-tag
44
+ id: tag
45
+ run: |
46
+ set +e
47
+ RESULT=$(node bin/create-tag.js)
48
+ STATUS=$?
49
+ TAG=$(echo "$RESULT" | jq -r '.tag // empty')
50
+
51
+ echo "$RESULT"
52
+ echo "status=$STATUS" >> $GITHUB_OUTPUT
53
+ echo "tag=$TAG" >> $GITHUB_OUTPUT
52
54
 
53
55
  # Publish to npm using Trusted Publishing (OIDC)
54
56
  - name: Publish to npm (Trusted Publishing)
57
+ if: steps.tag.outputs.status == '0' && steps.tag.outputs.tag != ''
55
58
  run: npm publish
56
59
 
57
60
  # Generate release notes for GitHub Release
58
61
  - name: Generate GitHub Release Notes
59
- run: rs-generate-release-notes
62
+ if: steps.tag.outputs.status == '0' && steps.tag.outputs.tag != ''
63
+ run: node bin/generate-release-notes.js
60
64
  env:
61
65
  GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
62
66
 
63
67
  # Create GitHub Release with notes and attach built assets
64
68
  - name: Create GitHub Release + Tag
69
+ if: steps.tag.outputs.status == '0' && steps.tag.outputs.tag != ''
65
70
  env:
66
71
  GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
67
72
  run: |
68
73
  VERSION=$(node -p "require('./package.json').version")
69
74
 
75
+ ASSETS=()
76
+ if [ -d dist ]; then
77
+ ASSETS=(dist/**)
78
+ fi
79
+
70
80
  gh release create "$VERSION" \
71
81
  --title "$VERSION" \
72
82
  --notes-file RELEASE_NOTES.md \
73
- ./dist/* || true
83
+ "${ASSETS[@]}"
package/CHANGELOG.md CHANGED
@@ -1,5 +1,52 @@
1
- ## 0.1.0
2
-
3
- ### 🔧 Chore
4
-
5
- - Init: project created
1
+ ## 1.0.1
2
+
3
+ ### 🐛 Fixes
4
+
5
+ - Harden changelog generation for squash commits (#13)
6
+
7
+ ### 📚 Docs
8
+
9
+ - Update ci/cd examples with trigger adjustment
10
+
11
+ ### 🔁 CI
12
+
13
+ - Adjust trigger in workflow
14
+
15
+ ## 1.0.0
16
+
17
+ ### đŸ’Ĩ Breaking Changes
18
+
19
+ - Harden computeVersion contract and CLI behavior (#4)
20
+
21
+ ### 🐛 Fixes
22
+
23
+ - Normalize path resolution for all CLI scripts (#2)
24
+
25
+ ### 🔧 Chore
26
+
27
+ -
28
+ -
29
+ -
30
+ -
31
+ -
32
+ -
33
+ -
34
+ -
35
+ -
36
+ -
37
+ -
38
+ -
39
+ -
40
+ -
41
+ -
42
+
43
+ ### 🔁 CI
44
+
45
+ - Harden local script execution and dist resolution (#10)
46
+ - Binary resolution (#3)
47
+
48
+ ## 0.1.0
49
+
50
+ ### 🔧 Chore
51
+
52
+ - Init: project created
package/README.md CHANGED
@@ -1,183 +1,195 @@
1
- # 🎉 Release Suite
2
-
3
- Semantic versioning tools for Git-based projects, providing automated version computation, changelog generation and release notes creation.
4
-
5
- ## 🚀 Features
6
-
7
- - Automatic version bump based on commit messages
8
- - Conventional commit parsing (custom prefixes supported)
9
- - Auto-generated `CHANGELOG.md`
10
- - Auto-generated `RELEASE_NOTES.md` using GitHub CLI (gh)
11
- - Local preview mode (`CHANGELOG.preview.md`, `RELEASE_NOTES.preview.md`)
12
- - CI/CD ready for GitHub Actions
13
- - No commit rules enforced on the main project
14
- - Trusted Publishing (OIDC) — no npm tokens required
15
-
16
- ## âš™ī¸ Installation
17
-
18
- ```bash
19
- npm install release-suite --save-dev
20
- ```
21
-
22
- ## đŸ–Ĩī¸ CLI Commands
23
-
24
- | Command | Description |
25
- | --------------------------- | --------------------------------------------------------- |
26
- | `rs-compute-version` | Computes next semantic version based on git commits |
27
- | `rs-generate-changelog` | Generates `CHANGELOG.md` |
28
- | `rs-generate-release-notes` | Generates `RELEASE_NOTES.md` using GitHub PRs |
29
- | `rs-preview` | Generates preview changelog & release notes |
30
- | `rs-create-tag` | Create and push a git tag based on `package.json` version |
31
-
32
- ## 🧠 Usage
33
-
34
- Add to your project's `package.json`:
35
-
36
- ```json
37
- {
38
- "scripts": {
39
- "version:compute": "rs-compute-version",
40
- "changelog": "rs-generate-changelog",
41
- "release:notes": "rs-generate-release-notes",
42
- "preview": "rs-preview create",
43
- "preview:clear": "rs-preview remove",
44
- "create-tag": "rs-create-tag",
45
- "create-tag:compute": "rs-create-tag --compute",
46
- "create-tag:dry": "rs-create-tag --dry-run"
47
- }
48
- }
49
- ```
50
-
51
- ## 🤖 CI/CD Usage (GitHub Actions)
52
-
53
- This project is designed to be used in automated pipelines.
54
-
55
- Typical flow:
56
-
57
- 1. Create a Release PR (compute version, changelog, build)
58
- 2. Review and merge the Release PR into `main`
59
- 3. Publish the release (tag, npm, GitHub Release)
60
-
61
- Example workflows:
62
- - create-release-pr.yml
63
- - publish-on-merge.yml
64
-
65
- ## 🔁 Release Flow
66
-
67
- This project follows a **two-step release strategy** designed for safety,
68
- automation and reusability.
69
-
70
- ### 1ī¸âƒŖ Prepare Release (Create Release PR)
71
-
72
- Triggered when:
73
-
74
- - A PR is merged into `main`
75
-
76
- Actions:
77
-
78
- - Computes next semantic version
79
- - Updates `package.json`
80
- - Generates `CHANGELOG.md`
81
- - Builds the project (if applicable)
82
- - Opens a **Release PR** (`release/v/x.y.z`)
83
-
84
- ### 2ī¸âƒŖ Publish Release
85
-
86
- Triggered when:
87
-
88
- - A Release PR (`release/v/*`) is merged into `main`
89
-
90
- Actions:
91
-
92
- - Creates a Git tag
93
- - Publishes to npm using **Trusted Publishing (OIDC)**
94
- - Generates GitHub Release Notes
95
- - Uploads build artifacts (`dist/**`)
96
-
97
- ---
98
-
99
- ### 📊 Flow Diagram
100
-
101
- ```mermaid
102
- flowchart TD
103
- A[Feature / Fix PR] -->|Merge| B[main]
104
- B -->|create-release-pr.yml| C[Create Release PR]
105
- C -->|release/v/x.y.z| D[Review & Merge]
106
- D -->|publish-on-merge.yml| E[Publish Release]
107
- E --> F[npm Publish]
108
- E --> G[GitHub Release]
109
- ```
110
-
111
- âœ”ī¸ Fully automated releases
112
- âœ”ī¸ No npm tokens or secrets required (OIDC)
113
- âœ”ī¸ No release loops
114
- âœ”ī¸ Safe for concurrent merges
115
- âœ”ī¸ Reusable in any project
116
-
117
- ## đŸ“Ļ Publishing to npm (Trusted Publishing)
118
-
119
- This project uses **npm [Trusted Publishing](https://docs.npmjs.com/trusted-publishers) with GitHub Actions (OIDC)**.
120
-
121
- - No npm tokens or secrets are required
122
- - Publishing is handled entirely by GitHub Actions
123
- - Triggered automatically when a Release PR is merged into `main`
124
-
125
- ## 🔍 Preview Mode
126
-
127
- Generate preview files without touching your real changelog:
128
-
129
- ```bash
130
- npm run preview
131
- ```
132
-
133
- Remove previews:
134
-
135
- ```bash
136
- npm run preview:clear
137
- ```
138
-
139
- ## 🛠 Development (Maintainers)
140
-
141
- When working inside the `release-suite` repository itself, the CLI binaries
142
- are **not available via npm or npx**, since they are not installed as a dependency.
143
-
144
- In this case, run the scripts directly with Node.js:
145
-
146
- ```bash
147
- node bin/compute-version.js
148
- node bin/generate-changelog.js
149
- node bin/generate-release-notes.js
150
- node bin/preview.js create
151
- node bin/create-tag.js
152
- ```
153
-
154
- To test the CLI as a real consumer, you can use:
155
-
156
- ```bash
157
- npm link
158
- # or
159
- npm install ../release-suite
160
- ```
161
-
162
- ## 📄 License
163
-
164
- This project is licensed under the [MIT License](./LICENSE).
165
-
166
- ---
167
-
168
- ## ✨ Author
169
-
170
- <table>
171
- <tr>
172
- <td align="center">
173
- <a href="https://jonasmzsouza.github.io/">
174
- <img style="border-radius: 50%;" src="https://avatars.githubusercontent.com/u/61324433?v=4" width="100px;" alt=""/>
175
- <br />
176
- <sub><b>Jonas Souza</b></sub>
177
- </a>
178
- </td>
179
- </tr>
180
- </table>
181
-
182
- đŸ’ŧ [LinkedIn](https://linkedin.com/in/jonasmzsouza)
183
- đŸ’ģ [GitHub](https://github.com/jonasmzsouza)
1
+ # 🎉 Release Suite
2
+
3
+ Semantic versioning tools for Git-based projects, providing automated version computation, changelog generation and release notes creation.
4
+
5
+ > Designed for safe, predictable and fully automated releases in GitHub Actions.
6
+
7
+ ## 🚀 Features
8
+
9
+ - Automatic version bump based on commit messages
10
+ - Conventional commit parsing (custom prefixes supported)
11
+ - Auto-generated `CHANGELOG.md`
12
+ - Auto-generated `RELEASE_NOTES.md` using GitHub CLI (gh)
13
+ - Local preview mode (`CHANGELOG.preview.md`, `RELEASE_NOTES.preview.md`)
14
+ - CI/CD ready for GitHub Actions
15
+ - No commit rules enforced on the main project
16
+ - Trusted Publishing (OIDC) — no npm tokens required
17
+
18
+ ## ⚡ Quick Start
19
+
20
+ ```bash
21
+ npm install release-suite --save-dev
22
+ ```
23
+
24
+ Add to your project's `package.json`:
25
+
26
+ ```json
27
+ {
28
+ "scripts": {
29
+ "preview": "rs-preview create",
30
+ "preview:clean": "rs-preview remove",
31
+ "compute-version": "rs-compute-version",
32
+ "compute-version:ci": "rs-compute-version --ci --json",
33
+ "compute-version:json": "rs-compute-version --json",
34
+ "changelog": "rs-generate-changelog",
35
+ "release-notes": "rs-generate-release-notes"
36
+ }
37
+ }
38
+ ```
39
+
40
+ Generate preview files without touching your real changelog:
41
+
42
+ ```bash
43
+ npm run preview
44
+ ```
45
+
46
+ Remove previews:
47
+
48
+ ```bash
49
+ npm run preview:clear
50
+ ```
51
+
52
+ ## đŸ–Ĩī¸ CLI Commands
53
+
54
+ | Command | Description |
55
+ | --------------------------- | --------------------------------------------------------- |
56
+ | `rs-compute-version` | Computes next semantic version based on git commits |
57
+ | `rs-generate-changelog` | Generates `CHANGELOG.md` |
58
+ | `rs-generate-release-notes` | Generates `RELEASE_NOTES.md` using GitHub PRs |
59
+ | `rs-preview` | Generates preview changelog & release notes |
60
+ | `rs-create-tag` | Create and push a git tag based on `package.json` version |
61
+
62
+ Each command follows a strict and predictable CLI contract (exit codes, stdout, JSON mode).
63
+
64
+ > 💡 **Note about execution**
65
+ >
66
+ > - When using these commands via `npm run`, they can be referenced directly (`rs-*`).
67
+ > - In CI/CD environments (e.g. GitHub Actions), always invoke them using `npx`
68
+ > (e.g. `npx rs-generate-changelog`) to ensure proper binary resolution.
69
+
70
+ ## 🔁 Release Flow
71
+
72
+ This project follows a **two-step release strategy** designed for safety,
73
+ automation and reusability.
74
+
75
+ ### 1ī¸âƒŖ Prepare Release (Create Release PR)
76
+
77
+ Triggered when:
78
+
79
+ - A PR is merged into `main`
80
+
81
+ Actions:
82
+
83
+ - Computes next semantic version
84
+ - Updates `package.json`
85
+ - Generates `CHANGELOG.md`
86
+ - Builds the project (if applicable)
87
+ - Opens a **Release PR** (`release/x.y.z`)
88
+
89
+ ### 2ī¸âƒŖ Publish Release
90
+
91
+ Triggered when:
92
+
93
+ - A Release PR (`release/x.y.z`) with `release` label is merged into `main`
94
+
95
+ Actions:
96
+
97
+ - Creates a Git tag
98
+ - Publishes to npm using **Trusted Publishing (OIDC)**
99
+ - Generates GitHub Release Notes
100
+ - Uploads build artifacts (`dist/**`)
101
+
102
+ ---
103
+
104
+ ### 📊 Flow Diagram
105
+
106
+ ```mermaid
107
+ flowchart TD
108
+ A[Feature / Fix PR] -->|Merge| B[main]
109
+ B -->|create-release-pr.yml| C[Create Release PR]
110
+ C -->|release/x.y.z| D[Review & Merge]
111
+ D -->|publish-on-merge.yml| E[Publish Release]
112
+ E --> F[npm Publish]
113
+ E --> G[GitHub Release]
114
+ ```
115
+
116
+ âœ”ī¸ Fully automated releases
117
+ âœ”ī¸ No npm tokens or secrets required (OIDC)
118
+ âœ”ī¸ No release loops
119
+ âœ”ī¸ Safe for concurrent merges
120
+ âœ”ī¸ Reusable in any project
121
+
122
+ ## 🤖 CI/CD Usage (GitHub Actions)
123
+
124
+ > â„šī¸ In CI/CD environments, always use `npx` when invoking `rs-*` commands.
125
+
126
+ This project is designed to be used in automated pipelines.
127
+
128
+ Typical flow:
129
+
130
+ 1. Create a Release PR (compute version, changelog, build)
131
+ 2. Review and merge the Release PR into `main`
132
+ 3. Publish the release (tag, npm, GitHub Release)
133
+
134
+ 👉 See full examples in [`docs/ci.md`](./docs/ci.md)
135
+
136
+ ## đŸ“Ļ Publishing to npm (Trusted Publishing)
137
+
138
+ This project uses **npm [Trusted Publishing](https://docs.npmjs.com/trusted-publishers) with GitHub Actions (OIDC)**.
139
+
140
+ - No npm tokens or secrets are required
141
+ - Publishing is handled entirely by GitHub Actions
142
+ - Triggered automatically when a Release PR is merged into `main`
143
+
144
+ ## 🧩 Programmatic API
145
+
146
+ Release Suite also exposes a programmatic API for advanced use cases
147
+ (integration tests, custom tooling, orchestration).
148
+
149
+ 👉 See full API documentation in [`docs/api.md`](./docs/api.md)
150
+
151
+ ## 🛠 Development (Maintainers)
152
+
153
+ When working inside the `release-suite` repository itself, the CLI binaries
154
+ are **not available via npm or npx**, since they are not installed as a dependency.
155
+
156
+ In this case, run the scripts directly with Node.js:
157
+
158
+ ```bash
159
+ node bin/compute-version.js
160
+ node bin/generate-changelog.js
161
+ node bin/generate-release-notes.js
162
+ node bin/preview.js create
163
+ node bin/create-tag.js
164
+ ```
165
+
166
+ To test the CLI as a real consumer, you can use:
167
+
168
+ ```bash
169
+ npm link
170
+ # or
171
+ npm install ../release-suite
172
+ ```
173
+
174
+ ## 📄 License
175
+
176
+ This project is licensed under the [MIT License](./LICENSE).
177
+
178
+ ---
179
+
180
+ ## ✨ Author
181
+
182
+ <table>
183
+ <tr>
184
+ <td align="center">
185
+ <a href="https://jonasmzsouza.github.io/">
186
+ <img style="border-radius: 50%;" src="https://avatars.githubusercontent.com/u/61324433?v=4" width="100px;" alt=""/>
187
+ <br />
188
+ <sub><b>Jonas Souza</b></sub>
189
+ </a>
190
+ </td>
191
+ </tr>
192
+ </table>
193
+
194
+ đŸ’ŧ [LinkedIn](https://linkedin.com/in/jonasmzsouza)
195
+ đŸ’ģ [GitHub](https://github.com/jonasmzsouza)