diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 360bb88..e88d853 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -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: diff --git a/package.json b/package.json index 33bc2e2..a926feb 100644 --- a/package.json +++ b/package.json @@ -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" } } diff --git a/release.mjs b/release.mjs index 4eaefc7..952f0ee 100755 --- a/release.mjs +++ b/release.mjs @@ -1,5 +1,3 @@ -#!/usr/bin/env zx - /* * Script to release the seats.io java lib. * - changes the version number in README.md @@ -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 @@ -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() { diff --git a/yarn.lock b/yarn.lock index 34225cb..000abc3 100644 --- a/yarn.lock +++ b/yarn.lock @@ -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" @@ -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== @@ -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== + +zx@8.1.4: + 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"