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 #27

Merged
merged 1 commit into from
Jul 19, 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
11 changes: 4 additions & 7 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
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 ios 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 latestVersion = await fetchLatestReleasedVersionNumber()
const nextVersion = await determineNextVersionNumber(latestVersion)
Expand All @@ -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() {
Expand Down
Loading