Skip to content

Commit

Permalink
Simplify release script
Browse files Browse the repository at this point in the history
  • Loading branch information
mortendevold committed Jul 18, 2024
1 parent 38606f1 commit 92b9d22
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 11 deletions.
9 changes: 2 additions & 7 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,8 @@ 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
- name: Install dependencies and run release script
run: yarn add -D -E [email protected] [email protected] && yarn zx ./release.mjs -v $VERSION_TO_BUMP
env:
VERSION_TO_BUMP: ${{ inputs.versionToBump }}
GH_TOKEN: ${{ github.token }}
Expand Down
8 changes: 4 additions & 4 deletions release.mjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env zx

/*
* Script to release the seats.io java lib.
* Script to release the seats.io php lib.
* - changes the version number in README.md
* - changes the version number in build.gradle
* - creates the release in Gihub (using gh cli)
Expand All @@ -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 latestReleaseTag = await fetchLatestReleasedVersionNumber()

Expand All @@ -44,7 +44,7 @@ async function fetchLatestReleasedVersionNumber() {
}

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

async function getCurrentCommitHash() {
Expand Down

0 comments on commit 92b9d22

Please sign in to comment.