From 67b78826c7d42968214d86078215e2ec40290f4e Mon Sep 17 00:00:00 2001 From: Morten Devold Date: Thu, 18 Jul 2024 15:30:50 +0200 Subject: [PATCH] Use zx and semver NPM packages in release script --- .github/workflows/release.yml | 11 ++++------- release.mjs | 8 ++++---- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3071491..8b93f31 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -22,13 +22,10 @@ jobs: steps: - uses: actions/checkout@v3 - uses: fregante/setup-git-user@v2 - - 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 + - name: Install dependencies + run: yarn add -D -E zx@8.1.4 semver@7.6.3 + - name: Run release script + run: yarn zx ./release.mjs -v $VERSION_TO_BUMP env: VERSION_TO_BUMP: ${{ inputs.versionToBump }} GH_TOKEN: ${{ github.token }} diff --git a/release.mjs b/release.mjs index 9b1fdab..2e09186 100755 --- a/release.mjs +++ b/release.mjs @@ -1,7 +1,7 @@ #!/usr/bin/env zx /* -* Script to release the seats.io java lib. +* Script to release the seats.io ios lib. * - changes the version number in README.md * - changes the version number in build.gradle * - creates the release in Gihub (using gh cli) @@ -10,15 +10,15 @@ * 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" * */ // don't output the commands themselves $.verbose = false +const semver = require('semver') const versionToBump = getVersionToBump() const latestVersion = await fetchLatestReleasedVersionNumber() const nextVersion = await determineNextVersionNumber(latestVersion) @@ -41,7 +41,7 @@ async function fetchLatestReleasedVersionNumber() { } async function determineNextVersionNumber(previous) { - return (await $`semver bump ${versionToBump} ${previous}`).stdout.trim() + return semver.inc(previous, versionToBump) } async function bumpVersionInFiles() {