Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify release flow by making zx a devDependency #218

Merged
merged 4 commits into from
Jul 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 2 additions & 12 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,21 +25,11 @@ jobs:
- uses: actions/setup-node@v4
with:
node-version: 20
- id: install-zx
run: npm i -g zx
- 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: zx ./release.mjs -v $VERSION_TO_BUMP
- run: yarn install
- run: yarn zx ./release.mjs -v $VERSION_TO_BUMP
env:
VERSION_TO_BUMP: ${{ inputs.versionToBump }}
GH_TOKEN: ${{ github.token }}
- uses: actions/setup-node@v4
with:
node-version: 20
registry-url: https://registry.npmjs.org/
- run: yarn install
- run: yarn build
- run: yarn publish
env:
Expand Down
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,10 @@
"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"
"typescript": "5.5.3",
"zx": "8.1.4"
}
}
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
25 changes: 24 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -895,6 +895,14 @@
resolved "https://registry.yarnpkg.com/@types/estree/-/estree-1.0.5.tgz#a6ce3e556e00fd9895dd872dd172ad0d4bd687f4"
integrity sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw==

"@types/fs-extra@>=11":
version "11.0.4"
resolved "https://registry.yarnpkg.com/@types/fs-extra/-/fs-extra-11.0.4.tgz#e16a863bb8843fba8c5004362b5a73e17becca45"
integrity sha512-yTbItCNreRooED33qjunPthRcSjERP1r4MqCZc7wv0u2sUkzTFp45tgUfS5+r7FrZPdmCCNflLhVSP/o+SemsQ==
dependencies:
"@types/jsonfile" "*"
"@types/node" "*"

"@types/graceful-fs@^4.1.3":
version "4.1.9"
resolved "https://registry.yarnpkg.com/@types/graceful-fs/-/graceful-fs-4.1.9.tgz#2a06bc0f68a20ab37b3e36aa238be6abdf49e8b4"
Expand Down Expand Up @@ -938,7 +946,14 @@
"@types/tough-cookie" "*"
parse5 "^7.0.0"

"@types/node@*":
"@types/jsonfile@*":
version "6.1.4"
resolved "https://registry.yarnpkg.com/@types/jsonfile/-/jsonfile-6.1.4.tgz#614afec1a1164e7d670b4a7ad64df3e7beb7b702"
integrity sha512-D5qGUYwjvnNNextdU59/+fI+spnwtTFmyQP0h+PfIOSkNfpU6AOICUOkm4i0OnSk+NyjdPJrxCDro0sJsWlRpQ==
dependencies:
"@types/node" "*"

"@types/node@*", "@types/node@>=20":
version "20.14.10"
resolved "https://registry.yarnpkg.com/@types/node/-/node-20.14.10.tgz#a1a218290f1b6428682e3af044785e5874db469a"
integrity sha512-MdiXf+nDuMvY0gJKxyfZ7/6UFsETO7mGKF54MVD/ekJS6HdFtpZFBgrh6Pseu64XTb2MLyFPlbW6hj8HYRQNOQ==
Expand Down Expand Up @@ -3430,3 +3445,11 @@ yocto-queue@^0.1.0:
version "0.1.0"
resolved "https://registry.yarnpkg.com/yocto-queue/-/yocto-queue-0.1.0.tgz#0294eb3dee05028d31ee1a5fa2c556a6aaf10a1b"
integrity sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==

[email protected]:
version "8.1.4"
resolved "https://registry.yarnpkg.com/zx/-/zx-8.1.4.tgz#19bcd543fab34d01d7d4174a314b33cde9115a17"
integrity sha512-QFDYYpnzdpRiJ3dL2102Cw26FpXpWshW4QLTGxiYfIcwdAqg084jRCkK/kuP/NOSkxOjydRwNFG81qzA5r1a6w==
optionalDependencies:
"@types/fs-extra" ">=11"
"@types/node" ">=20"
Loading