From c63420cd9c41ef01b041389e6ba07d985fabb0ce Mon Sep 17 00:00:00 2001 From: Billy Batista Date: Thu, 13 Jun 2024 12:42:11 -0400 Subject: [PATCH] Automatically release a new version of flyctl daily (#3626) * Automatically release a new version of flyctl daily * Only run monday through thursday * Added some info about automatic releases to the README * Eastern Standard Time Not Eastern time (daylight savings not included) --- .github/workflows/auto-release.yml | 17 +++++++++++++++++ README.md | 3 +++ scripts/force_bump_version.sh | 24 ++++++++++++++++++++++++ 3 files changed, 44 insertions(+) create mode 100644 .github/workflows/auto-release.yml create mode 100755 scripts/force_bump_version.sh diff --git a/.github/workflows/auto-release.yml b/.github/workflows/auto-release.yml new file mode 100644 index 0000000000..4ee0d39c1b --- /dev/null +++ b/.github/workflows/auto-release.yml @@ -0,0 +1,17 @@ +name: Automatically release a new version of flyctl + +on: + schedule: + - cron: '0 20 * * MON-THU' # Runs at 3 PM Eastern Standard Time Monday Through Thursday (8 PM UTC) + +jobs: + run_script: + runs-on: ubuntu-latest + steps: + - name: Checkout master branch + uses: actions/checkout@v3 + with: + ref: master + - name: bump version + run: | + ./scripts/force_bump_version.sh diff --git a/README.md b/README.md index 1520dd7fd2..c6274efc23 100644 --- a/README.md +++ b/README.md @@ -89,6 +89,9 @@ app: banana `flyctl` will operate against the `banana` app unless overridden by the -a flag or other app name setting in the command line. +## Releases +`flyctl` is automatically released at 3 PM Eastern Standard Time Monday - Thursday. If needed, you can bump a release by running `./scripts/bump_version.sh`. + ## Building on Windows There is a simple Powershell script, `winbuild.ps1`, which will run the code generation for the help files, format them, and run a full build, leaving a new binary in the bin directory. diff --git a/scripts/force_bump_version.sh b/scripts/force_bump_version.sh new file mode 100755 index 0000000000..261c86359c --- /dev/null +++ b/scripts/force_bump_version.sh @@ -0,0 +1,24 @@ +#!/usr/bin/env bash + +set -euo pipefail + +ORIGIN=${ORIGIN:-origin} + +bump=${1:-patch} + +dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + +previous_version="$("$dir"/../scripts/version.sh -s)" + +prerelversion=$("$dir"/../scripts/semver get prerel "$previous_version") +if [[ $prerelversion == "" ]]; then + new_version=$("$dir"/../scripts/semver bump "$bump" "$previous_version") +else + new_version=${previous_version//-$prerelversion/} +fi + +new_version="v$new_version" + +echo "Bumping version from v${previous_version} to ${new_version}" + +git tag -m "release ${new_version}" -a "$new_version" && git push "${ORIGIN}" tag "$new_version"