Skip to content

Commit 191d004

Browse files
committed
Improve release automation
1 parent 090ca0d commit 191d004

6 files changed

Lines changed: 41 additions & 17 deletions

File tree

.github/workflows/release.yml

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,37 @@ jobs:
2121
- run: npm install
2222
env:
2323
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
24+
- run: npm run test:local
2425
- run: npm run build
2526
- run: npm publish --access public --provenance
2627
env:
2728
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
2829

29-
- uses: ncipollo/release-action@v1
30+
# create GitHub release
31+
- name: Extract release notes
32+
id: extract_release_notes
33+
run: |
34+
# Extract version from tag (remove 'v' prefix)
35+
VERSION=${GITHUB_REF#refs/tags/v}
36+
echo "version=$VERSION" >> $GITHUB_OUTPUT
37+
38+
# Extract changelog section for this version with better handling
39+
if grep -q "## \[$VERSION\]" CHANGELOG.md; then
40+
awk "/^## \[$VERSION\]/ {flag=1; next} /^## \[/ && flag {exit} flag && /\S/ {print}" CHANGELOG.md > release_notes.md
41+
echo "Release notes extracted for version $VERSION:"
42+
cat release_notes.md
43+
else
44+
echo "No changelog entry found for version $VERSION" > release_notes.md
45+
echo "Warning: No changelog entry found for version $VERSION"
46+
fi
47+
48+
- name: Create GitHub Release
49+
uses: softprops/action-gh-release@v2
3050
with:
31-
artifacts: "dist/amqp-websocket-client.mjs*"
32-
token: ${{ secrets.GITHUB_TOKEN }}
51+
name: Release ${{ steps.extract_release_notes.outputs.version }}
52+
body_path: release_notes.md
53+
draft: false
54+
prerelease: false
55+
files: |
56+
dist/amqp-websocket-client.mjs
57+
dist/amqp-websocket-client.mjs.map

CHANGELOG.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10-
## [3.3.1] - 2025-09-12
11-
12-
## [3.3.0] - 2025-09-12
13-
1410
### Fixed
1511

1612
- Improve connection loss handling for WebSocket connections ([#152](https://github.com/cloudamqp/amqp-client.js/pull/152))

README.md

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -174,12 +174,15 @@ The package.json includes several npm scripts for releasing:
174174
### What happens during a release
175175

176176
1. **Tests**: All tests are run to ensure everything passes (`preversion`)
177-
2. **Version bump**: The version is updated in `package.json` and `src/amqp-base-client.ts` (`version`)
178-
3. **Changelog update**: The `## [Unreleased]` section is converted to the actual version and date (`postversion`)
179-
4. **Git commit**: A commit is created with the version change and changelog update
180-
5. **Git tag**: An annotated tag is created with the full changelog content as the tag message
181-
6. **Push**: Both the commit and tags are pushed to the remote repository
182-
7. **CI deployment**: The GitHub Actions workflow automatically publishes the new version to npm
177+
2. **Version bump**: npm automatically updates the version in `package.json`
178+
3. **File updates**: The version is updated in `src/amqp-base-client.ts`, code is formatted, and changelog is updated (`version`)
179+
4. **Staging**: All changes are staged for commit (`version`)
180+
5. **Git commit**: npm automatically commits all staged changes with a version message
181+
6. **Git tag**: An annotated tag is created with the full changelog content as the tag message (`postversion`)
182+
7. **Push**: Both the commit and tags are pushed to the remote repository (`postversion`)
183+
8. **CI deployment**: The GitHub Actions workflow automatically publishes the new version to npm
184+
185+
> **Technical Note**: This release process leverages npm's built-in version lifecycle hooks (`preversion`, `version`, `postversion`). The `npm version` command automatically handles the git commit after running our custom `version` script, which is why we stage changes with `git add -A` rather than committing manually.
183186
184187
### Prerequisites
185188

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@cloudamqp/amqp-client",
3-
"version": "3.3.1",
3+
"version": "3.2.0",
44
"description": "AMQP 0-9-1 client, both for browsers (WebSocket) and node (TCP Socket)",
55
"type": "module",
66
"main": "lib/cjs/index.js",

src/amqp-base-client.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { AMQPMessage } from "./amqp-message.js"
55
import { AMQPView } from "./amqp-view.js"
66
import type { Logger } from "./types.js"
77

8-
export const VERSION = "3.3.1"
8+
export const VERSION = "3.2.0"
99

1010
/**
1111
* Base class for AMQPClients.

0 commit comments

Comments
 (0)