Skip to content

Commit a080b6c

Browse files
committed
Overhaul CI to use semantic versioning, changelogs, and GitHub releases
- Replace manual version string with github-tag-action for semver based on commit message tokens (#major, #minor, #patch) - Add automatic changelog generation via tag-changelog - Create GitHub releases with softprops/action-gh-release - Simplify publish step to use the tag from bump output
1 parent 42c2671 commit a080b6c

1 file changed

Lines changed: 27 additions & 8 deletions

File tree

.github/workflows/npm-publish-github-packages.yml

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,21 +35,40 @@ jobs:
3535
- name: Run tests
3636
run: bun test
3737

38-
- name: Bum new version
38+
- name: Bump version and push tag
39+
uses: anothrNick/github-tag-action@v1
3940
id: bump
40-
run: |
41-
COMMIT_HASH=${{ github.sha }}
42-
COMMIT_SHORT=${COMMIT_HASH:0:7}
43-
NEW_VERSION="1.0.0-run${{ github.run_number }}+${COMMIT_SHORT}"
44-
echo "version=$NEW_VERSION" >> $GITHUB_OUTPUT
41+
env:
42+
GITHUB_TOKEN: ${{ github.token }}
43+
MAJOR_STRING_TOKEN: '#major'
44+
MINOR_STRING_TOKEN: '#minor'
45+
PATCH_STRING_TOKEN: '#patch'
46+
NONE_STRING_TOKEN: '#none'
47+
TAG_PREFIX: v
48+
VERBOSE: false
4549

50+
- name: Build Changelog
51+
id: changelog
52+
uses: loopwerk/tag-changelog@v1
53+
with:
54+
token: ${{ github.token }}
55+
56+
- name: Release
57+
uses: softprops/action-gh-release@v2
58+
with:
59+
token: ${{ github.token }}
60+
generate_release_notes: true
61+
append_body: true
62+
make_latest: true
63+
tag_name: ${{ steps.bump.outputs.tag }}
64+
name: ${{ steps.bump.outputs.tag }}
65+
body: ${{ steps.changelog.outputs.changelog }}
4666

4767
- name: Bump version and publish
4868
env:
4969
GITHUB_TOKEN: ${{ github.token }}
5070
run: |
51-
npm version ${{ steps.bump.outputs.version }} --no-git-tag-version
52-
5371
bun publish \
72+
--tag ${{ steps.bump.outputs.tag }} \
5473
--tolerate-republish \
5574
--production

0 commit comments

Comments
 (0)