Skip to content

Commit

Permalink
Use semver module instead of installing a cli tool
Browse files Browse the repository at this point in the history
  • Loading branch information
mroloux committed Jul 12, 2024
1 parent 7ecde9d commit 6b6d42a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 10 deletions.
4 changes: 0 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,6 @@ jobs:
with:
node-version: 20
- run: yarn install
- id: install-semver-tool
run: |
wget -O /usr/local/bin/semver https://raw.githubusercontent.com/fsaintjacques/semver-tool/master/src/semver
chmod +x /usr/local/bin/semver
- run: yarn zx ./release.mjs -v $VERSION_TO_BUMP
env:
VERSION_TO_BUMP: ${{ inputs.versionToBump }}
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
"jest-environment-jsdom": "29.7.0",
"react": "18.3.1",
"react-dom": "18.3.1",
"semver": "7.6.2",
"ts-jest": "29.1.5",
"tsup": "8.1.0",
"typescript": "5.5.3",
Expand Down
11 changes: 5 additions & 6 deletions release.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#!/usr/bin/env zx

/*
* Script to release the seats.io java lib.
* - changes the version number in README.md
Expand All @@ -10,11 +8,12 @@
* Prerequisites:
* - zx installed (https://github.com/google/zx)
* - gh cli installed (https://cli.github.com/)
* - semver cli installed (https://github.com/fsaintjacques/semver-tool)
*
* Usage:
* zx ./release.mjs -v major/minor -n "release notes"
* */
* yarn zx ./release.mjs -v major/minor -n "release notes"
*
*/
const semver = require('semver')

// don't output the commands themselves
$.verbose = false
Expand Down Expand Up @@ -49,7 +48,7 @@ async function fetchLatestReleasedVersionNumber() {
}

async function determineNextVersionNumber(previous) {
return (await $`semver bump ${versionToBump} ${previous}`).stdout.trim()
return semver.inc(previous, versionToBump)
}

async function bumpVersionInFiles() {
Expand Down

0 comments on commit 6b6d42a

Please sign in to comment.