refactor: use script/bump-version.sh instead of Makefile (#7907)

There isn't a good reason why we're using a Makefile instead of regular
Bash script for bumping versions, so this PR fixes that for better
maintainability.

It also reduces then chances for merge conflicts when bumping version
because the versions are longer on adjacent lines.

Fixes: #7904
This commit is contained in:
Jamil
2025-01-28 23:47:05 +00:00
committed by GitHub
parent 9c4b3bc6c3
commit 1ec3db387e
4 changed files with 183 additions and 85 deletions

View File

@@ -30,13 +30,13 @@ jobs:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Check version is up to date
run: |
make -f scripts/Makefile version
./scripts/bump-versions.sh
if [ -z "$(git status --porcelain)" ]; then
# Working directory clean
echo "Version manifests up to date"
else
# Uncommitted changes
echo '`make version` found outdated files! Showing diff'
echo '`scripts/bump-versions.sh` found outdated files! Showing diff'
git diff
exit 1
fi

View File

@@ -11,7 +11,7 @@ Table of Contents:
## Releasing
**Note**: The version for all published components is set from [scripts/Makefile](../scripts/Makefile).
**Note**: The version for all published components is set from [scripts/bump-versions.sh](../scripts/bump-versions.sh).
### App Store clients (Apple/Android)
@@ -31,7 +31,7 @@ Given that `main` is tested:
correct changes.
1. Publish the release. Tags and release name should be auto generated. This will trigger pushing Docker images to `ghcr.io`.
1. Open a PR and make the following changes:
1. Update [scripts/Makefile](../scripts/Makefile) with the new version number(s). Run `make -f scripts/Makefile version` to propagate the versions in the Makefile to all components.
1. Update [scripts/bump-versions.sh](../scripts/bump-versions.sh) with the new version number(s). Run `scripts/bump-versions.sh` to propagate the versions all components.
1. Update the Changelog (e.g. `../website/src/components/Changelog/GUI.tsx`) with:
1. New version numbers
1. Release notes

View File

@@ -1,81 +0,0 @@
# Format: Semver
# See discussion here: https://github.com/firezone/firezone/issues/2041
# and PR changing it here: https://github.com/firezone/firezone/pull/2949
# Release Instructions (Gateway/GUI/Headless)
# 1. Publish the appropriate drafted release on GitHub
# 2. Bump the appropriate version in this file
# 3. Run `make version`
# 4. Commit the changes
# 5. Open a PR with the changes
#
# Release Instructions (Apple/Android)
# 1. Run the Swift or Kotlin workflow on main. This will push a build to AppStore Connect or Firebase.
# 2. Create a new release in AppStore Connect or Firebase appropriately and submit.
# 3. When the release is approved and live, bump the appropriate version in this file.
#
# CI will prevent pushing assets to releases that are published, so you need to bump
# the relevant versions in order to push to a newly drafted release.
# Tracks the current version to use for generating download links and changelogs
current-apple-version = 1.4.0
current-android-version = 1.4.0
current-gateway-version = 1.4.3
current-gui-version = 1.4.1
current-headless-version = 1.4.1
# Tracks the next version to release for each platform
next-apple-version = 1.4.1
next-android-version = 1.4.1
next-gateway-version = 1.4.4
next-gui-version = 1.4.2
next-headless-version = 1.4.2
# macOS uses a slightly different sed syntax
ifeq ($(shell uname),Darwin)
SEDARG := -i ''
else
SEDARG := -i
endif
.PHONY: apple-version android-version gateway-version gui-version headless-version version
apple-version:
@find website -type f -name "redirects.js" -exec sed $(SEDARG) -e '/mark:current-apple-version/{n;s/[0-9]\{1,\}\.[0-9]\{1,\}\.[0-9]\{1,\}/$(current-apple-version)/g;}' {} \;
@find website -type f -name "route.ts" -exec sed $(SEDARG) -e '/mark:current-apple-version/{n;s/[0-9]\{1,\}\.[0-9]\{1,\}\.[0-9]\{1,\}/$(current-apple-version)/g;}' {} \;
@find .github -type f -exec sed $(SEDARG) -e '/mark:next-apple-version/{n;s/[0-9]\{1,\}\.[0-9]\{1,\}\.[0-9]\{1,\}/$(next-apple-version)/g;}' {} \;
@find swift -type f -name "project.pbxproj" -exec sed $(SEDARG) -e 's/MARKETING_VERSION = .*;/MARKETING_VERSION = $(next-apple-version);/' {} \;
@find rust -path rust/gui-client/node_modules -prune -o -name "Cargo.toml" -exec sed $(SEDARG) -e '/mark:next-apple-version/{n;s/[0-9]\{1,\}\.[0-9]\{1,\}\.[0-9]\{1,\}/$(next-apple-version)/;}' {} \;
@cd rust && cargo update --workspace
android-version:
@find website -type f -name "redirects.js" -exec sed $(SEDARG) -e '/mark:current-android-version/{n;s/[0-9]\{1,\}\.[0-9]\{1,\}\.[0-9]\{1,\}/$(current-android-version)/g;}' {} \;
@find website -type f -name "route.ts" -exec sed $(SEDARG) -e '/mark:current-android-version/{n;s/[0-9]\{1,\}\.[0-9]\{1,\}\.[0-9]\{1,\}/$(current-android-version)/g;}' {} \;
@find .github -type f -exec sed $(SEDARG) -e '/mark:next-android-version/{n;s/[0-9]\{1,\}\.[0-9]\{1,\}\.[0-9]\{1,\}/$(next-android-version)/g;}' {} \;
@find kotlin -type f -name "*.gradle.kts" -exec sed $(SEDARG) -e '/mark:next-android-version/{n;s/versionName =.*/versionName = "$(next-android-version)"/;}' {} \;
@find rust -path rust/gui-client/node_modules -prune -o -name "Cargo.toml" -exec sed $(SEDARG) -e '/mark:next-android-version/{n;s/[0-9]\{1,\}\.[0-9]\{1,\}\.[0-9]\{1,\}/$(next-android-version)/;}' {} \;
@cd rust && cargo update --workspace
gateway-version:
@find website -type f -name "redirects.js" -exec sed $(SEDARG) -e '/mark:current-gateway-version/{n;s/[0-9]\{1,\}\.[0-9]\{1,\}\.[0-9]\{1,\}/$(current-gateway-version)/g;}' {} \;
@find website -type f -name "route.ts" -exec sed $(SEDARG) -e '/mark:current-gateway-version/{n;s/[0-9]\{1,\}\.[0-9]\{1,\}\.[0-9]\{1,\}/$(current-gateway-version)/g;}' {} \;
@find .github -type f -exec sed $(SEDARG) -e '/mark:next-gateway-version/{n;s/[0-9]\{1,\}\.[0-9]\{1,\}\.[0-9]\{1,\}/$(next-gateway-version)/g;}' {} \;
@find rust -path rust/gui-client/node_modules -prune -o -name "Cargo.toml" -exec sed $(SEDARG) -e '/mark:next-gateway-version/{n;s/[0-9]\{1,\}\.[0-9]\{1,\}\.[0-9]\{1,\}/$(next-gateway-version)/;}' {} \;
@cd rust && cargo update --workspace
gui-version:
@find website -type f -name "redirects.js" -exec sed $(SEDARG) -e '/mark:current-gui-version/{n;s/[0-9]\{1,\}\.[0-9]\{1,\}\.[0-9]\{1,\}/$(current-gui-version)/g;}' {} \;
@find website -type f -name "route.ts" -exec sed $(SEDARG) -e '/mark:current-gui-version/{n;s/[0-9]\{1,\}\.[0-9]\{1,\}\.[0-9]\{1,\}/$(current-gui-version)/g;}' {} \;
@find .github -type f -exec sed $(SEDARG) -e '/mark:next-gui-version/{n;s/[0-9]\{1,\}\.[0-9]\{1,\}\.[0-9]\{1,\}/$(next-gui-version)/g;}' {} \;
@find rust -path rust/gui-client/node_modules -prune -o -name "Cargo.toml" -exec sed $(SEDARG) -e '/mark:next-gui-version/{n;s/[0-9]\{1,\}\.[0-9]\{1,\}\.[0-9]\{1,\}/$(next-gui-version)/;}' {} \;
@find rust -path rust/gui-client/node_modules -prune -o -name "*.rs" -exec sed $(SEDARG) -e '/mark:next-gui-version/{n;s/[0-9]\{1,\}\.[0-9]\{1,\}\.[0-9]\{1,\}/$(next-gui-version)/;}' {} \;
@cd rust && cargo update --workspace
headless-version:
@find website -type f -name "redirects.js" -exec sed $(SEDARG) -e '/mark:current-headless-version/{n;s/[0-9]\{1,\}\.[0-9]\{1,\}\.[0-9]\{1,\}/$(current-headless-version)/g;}' {} \;
@find website -type f -name "route.ts" -exec sed $(SEDARG) -e '/mark:current-headless-version/{n;s/[0-9]\{1,\}\.[0-9]\{1,\}\.[0-9]\{1,\}/$(current-headless-version)/g;}' {} \;
@find .github -name "*.yml" -exec sed $(SEDARG) -e '/mark:next-headless-version/{n;s/[0-9]\{1,\}\.[0-9]\{1,\}\.[0-9]\{1,\}/$(next-headless-version)/g;}' {} \;
@find rust -path rust/gui-client/node_modules -prune -o -name "Cargo.toml" -exec sed $(SEDARG) -e '/mark:next-headless-version/{n;s/[0-9]\{1,\}\.[0-9]\{1,\}\.[0-9]\{1,\}/$(next-headless-version)/;}' {} \;
@cd rust && cargo update --workspace
version: apple-version android-version gateway-version gui-version headless-version

179
scripts/bump-versions.sh Executable file
View File

@@ -0,0 +1,179 @@
#!/usr/bin/env bash
set -xeuo pipefail
# This is script is used to bump the versions in support of our release process.
# See discussion here: https://github.com/firezone/firezone/issues/2041
# and PR changing it here: https://github.com/firezone/firezone/pull/2949
# macOS uses a slightly different sed syntax
if [ "$(uname)" = "Darwin" ]; then
SEDARG=(-i '')
else
SEDARG=(-i)
fi
function cargo_update_workspace() {
pushd rust >/dev/null
cargo update --workspace
popd >/dev/null
}
# macOS / iOS
#
# There are 3 distributables we ship for Apple platforms:
# - macOS standalone
# - macOS app store
# - iOS app store
#
# The versioning among them are currently coupled together, such that if a
# release for one is rejected by app review, it impacts the remaining ones.
#
# As such, it's a good idea to make sure both app store releases are approved
# before publishing the macOS standalone release.
#
# Instructions:
# 1. Run the `Swift` workflow from `main`. This will push iOS and macOS app
# store builds to AppStore Connect and upload a new standalone DMG to the
# drafted release.
# 2. Sign in to AppStore Connect and create new iOS and macOS releases and
# submit them for review. Ensure the "automatically publish release" is
# DISABLED.
# 3. Once *both* are approved, publish them in the app stores.
# 4. Publish the macOS standalone drafted release on GitHub.
# 5. Come back here and bump the current and next versions.
# 6. Run `scripts/bump-versions.sh apple` to update the versions in the codebase.
# 7. Commit the changes and open a PR. Ensure the Changelog is correctly
# updated with the changes.
function apple() {
current_apple_version="1.4.0"
next_apple_version="1.4.1"
find website -type f -name "redirects.js" -exec sed "${SEDARG[@]}" -e '/mark:current_apple_version/{n;s/[0-9]\{1,\}\.[0-9]\{1,\}\.[0-9]\{1,\}/'"${current_apple_version}"'/g;}' {} \;
find website -type f -name "route.ts" -exec sed "${SEDARG[@]}" -e '/mark:current_apple_version/{n;s/[0-9]\{1,\}\.[0-9]\{1,\}\.[0-9]\{1,\}/'"${current_apple_version}"'/g;}' {} \;
find .github -type f -exec sed "${SEDARG[@]}" -e '/mark:next_apple_version/{n;s/[0-9]\{1,\}\.[0-9]\{1,\}\.[0-9]\{1,\}/'"${next_apple_version}"'/g;}' {} \;
find swift -type f -name "project.pbxproj" -exec sed "${SEDARG[@]}" -e "s/MARKETING_VERSION = .*;/MARKETING_VERSION = ${next_apple_version};/" {} \;
find rust -path rust/gui-client/node_modules -prune -o -name "Cargo.toml" -exec sed "${SEDARG[@]}" -e '/mark:next_apple_version/{n;s/[0-9]\{1,\}\.[0-9]\{1,\}\.[0-9]\{1,\}/'"${next_apple_version}"'/;}' {} \;
cargo_update_workspace
}
# Android / ChromeOS
#
# We support Android and ChromeOS with a single build. There are two
# distributables we ship:
#
# - AAB for the Play Store
# - APK for standalone distribution
#
# As such, the process for releasing Android is similar to Apple.
#
# Instructions:
# 1. Run the `Kotlin` workflow from `main`. This will push an AAB to Firebase.
# and upload a new APK to the drafted release.
# 2. Sign in to Firebase and download the build AAB, optionally distributing it
# for release testing to perform any final QA tests.
# 3. Sign in to the Play Console and create a new release and submit it for
# review. Optionally, allow the Play Console to automatically publish the
# release.
# 4. Once the Play Store release is approved, publish the APK in the drafted
# release on GitHub.
# 5. Come back here and bump the current and next versions.
# 6. Run `scripts/bump-versions.sh android` to update the versions in the codebase.
# 7. Commit the changes and open a PR. Ensure the Changelog is correctly
# updated with the changes.
function android() {
current_android_version="1.4.0"
next_android_version="1.4.1"
find website -type f -name "redirects.js" -exec sed "${SEDARG[@]}" -e '/mark:current-android-version/{n;s/[0-9]\{1,\}\.[0-9]\{1,\}\.[0-9]\{1,\}/'"${current_android_version}"'/g;}' {} \;
find website -type f -name "route.ts" -exec sed "${SEDARG[@]}" -e '/mark:current-android-version/{n;s/[0-9]\{1,\}\.[0-9]\{1,\}\.[0-9]\{1,\}/'"${current_android_version}"'/g;}' {} \;
find .github -type f -exec sed "${SEDARG[@]}" -e '/mark:next-android-version/{n;s/[0-9]\{1,\}\.[0-9]\{1,\}\.[0-9]\{1,\}/'"${next_android_version}"'/g;}' {} \;
find kotlin -type f -name "*.gradle.kts" -exec sed "${SEDARG[@]}" -e '/mark:next-android-version/{n;s/versionName =.*/versionName = "'"${next_android_version}"'"/;}' {} \;
find rust -path rust/gui-client/node_modules -prune -o -name "Cargo.toml" -exec sed "${SEDARG[@]}" -e '/mark:next-android-version/{n;s/[0-9]\{1,\}\.[0-9]\{1,\}\.[0-9]\{1,\}/'"${next_android_version}"'/;}' {} \;
cargo_update_workspace
}
# Windows / Linux GUI
#
# We support Windows and Linux with a single build workflow.
#
# Instructions:
# 1. Run the `Tauri` workflow from `main`. This will push new release assets to
# the drafted release on GitHub.
# 2. Perform any final QA testing on the new release assets, then publish the
# release.
# 3. Come back here and bump the current and next versions.
# 4. Run `scripts/bump-versions.sh gui` to update the versions in the codebase.
# 5. Commit the changes and open a PR. Ensure the Changelog is correctly
# updated with the changes.
function gui() {
current_gui_version="1.4.1"
next_gui_version="1.4.2"
find website -type f -name "redirects.js" -exec sed "${SEDARG[@]}" -e '/mark:current_gui_version/{n;s/[0-9]\{1,\}\.[0-9]\{1,\}\.[0-9]\{1,\}/'"${current_gui_version}"'/g;}' {} \;
find website -type f -name "route.ts" -exec sed "${SEDARG[@]}" -e '/mark:current_gui_version/{n;s/[0-9]\{1,\}\.[0-9]\{1,\}\.[0-9]\{1,\}/'"${current_gui_version}"'/g;}' {} \;
find .github -type f -exec sed "${SEDARG[@]}" -e '/mark:next_gui_version/{n;s/[0-9]\{1,\}\.[0-9]\{1,\}\.[0-9]\{1,\}/'"${next_gui_version}"'/g;}' {} \;
find rust -path rust/gui-client/node_modules -prune -o -name "Cargo.toml" -exec sed "${SEDARG[@]}" -e '/mark:next_gui_version/{n;s/[0-9]\{1,\}\.[0-9]\{1,\}\.[0-9]\{1,\}/'"${next_gui_version}"'/;}' {} \;
find rust -path rust/gui-client/node_modules -prune -o -name "*.rs" -exec sed "${SEDARG[@]}" -e '/mark:next_gui_version/{n;s/[0-9]\{1,\}\.[0-9]\{1,\}\.[0-9]\{1,\}/'"${next_gui_version}"'/;}' {} \;
cargo_update_workspace
}
# Linux Headless
#
# Unlike the Apple, Android, and GUI clients, headless binaries for Linux are
# built on each `main` workflow.
#
# Instructions:
# 1. Perform any final QA testing on the new release assets, then publish the
# drafted release.
# 2. Come back here and bump the current and next versions.
# 3. Run `scripts/bump-versions.sh headless` to update the versions in the codebase.
# 4. Commit the changes and open a PR. Ensure the Changelog is correctly
# updated with the changes.
function headless() {
current_headless_version="1.4.1"
next_headless_version="1.4.2"
find website -type f -name "redirects.js" -exec sed "${SEDARG[@]}" -e '/mark:current-headless-version/{n;s/[0-9]\{1,\}\.[0-9]\{1,\}\.[0-9]\{1,\}/'"${current_headless_version}"'/g;}' {} \;
find website -type f -name "route.ts" -exec sed "${SEDARG[@]}" -e '/mark:current-headless-version/{n;s/[0-9]\{1,\}\.[0-9]\{1,\}\.[0-9]\{1,\}/'"${current_headless_version}"'/g;}' {} \;
find .github -name "*.yml" -exec sed "${SEDARG[@]}" -e '/mark:next-headless-version/{n;s/[0-9]\{1,\}\.[0-9]\{1,\}\.[0-9]\{1,\}/'"${next_headless_version}"'/g;}' {} \;
find rust -path rust/gui-client/node_modules -prune -o -name "Cargo.toml" -exec sed "${SEDARG[@]}" -e '/mark:next-headless-version/{n;s/[0-9]\{1,\}\.[0-9]\{1,\}\.[0-9]\{1,\}/'"${next_headless_version}"'/;}' {} \;
cargo_update_workspace
}
# Gateway
#
# Unlike the Apple, Android, and GUI clients, gateway binaries for Linux are
# built on each `main` workflow.
#
# Instructions:
# 1. Perform any final QA testing on the new release assets, then publish the
# drafted release.
# 2. Come back here and bump the current and next versions.
# 3. Run `scripts/bump-versions.sh gateway` to update the versions in the codebase.
# 4. Commit the changes and open a PR. Ensure the Changelog is correctly
# updated with the changes.
function gateway() {
current_gateway_version="1.4.3"
next_gateway_version="1.4.4"
find website -type f -name "redirects.js" -exec sed "${SEDARG[@]}" -e '/mark:current-gateway-version/{n;s/[0-9]\{1,\}\.[0-9]\{1,\}\.[0-9]\{1,\}/'"${current_gateway_version}"'/g;}' {} \;
find website -type f -name "route.ts" -exec sed "${SEDARG[@]}" -e '/mark:current-gateway-version/{n;s/[0-9]\{1,\}\.[0-9]\{1,\}\.[0-9]\{1,\}/'"${current_gateway_version}"'/g;}' {} \;
find .github -type f -exec sed "${SEDARG[@]}" -e '/mark:next-gateway-version/{n;s/[0-9]\{1,\}\.[0-9]\{1,\}\.[0-9]\{1,\}/'"${next_gateway_version}"'/g;}' {} \;
find rust -path rust/gui-client/node_modules -prune -o -name "Cargo.toml" -exec sed "${SEDARG[@]}" -e '/mark:next-gateway-version/{n;s/[0-9]\{1,\}\.[0-9]\{1,\}\.[0-9]\{1,\}/'"${next_gateway_version}"'/;}' {} \;
cargo_update_workspace
}
function version() {
apple
android
gui
headless
gateway
}
if [ "$#" -eq 0 ]; then
version
else
"$@"
fi