diff --git a/MAINTAINERS.md b/MAINTAINERS.md index 010adcb..b204498 100644 --- a/MAINTAINERS.md +++ b/MAINTAINERS.md @@ -33,5 +33,5 @@ The GitHub workflow will fail initially because the jobs which test the installe Releasing a new version is a three-step process: 1. Bump the version in `[file:Cargo.toml]`, run `cargo build` to update `[file:Cargo.lock]`, and update `[file:CHANGELOG.md]` with information about the new version. Ship those changes as a single commit. -2. Once the GitHub workflow has finished on the `main` branch, update the version in `[file:install.sh]` to point to the new release. Also, update the `rev` in the example pre-commit configuration in `[file:README.md]` to point to the new version. +2. Once the GitHub workflow has finished on the `main` branch, the installation script will begin installing the new release by default. Update the `rev` in the example pre-commit configuration in `[file:README.md]` to point to the new version. 3. Create a pull request in the `Homebrew/homebrew-core` repository on GitHub to bump the version in [this file](https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/t/tagref.rb). diff --git a/install.sh b/install.sh index 04aa79a..e477e50 100755 --- a/install.sh +++ b/install.sh @@ -13,9 +13,6 @@ # Where the binary will be installed DESTINATION="${PREFIX:-/usr/local/bin}/tagref" - # Which version to download - RELEASE="v${VERSION:-1.13.0}" - # Determine which binary to download. FILENAME='' if uname -a | grep -qi 'x86_64.*GNU/Linux'; then @@ -56,10 +53,15 @@ # Compute the full file path. SOURCE="$TEMPDIR/$FILENAME" + # Download the requested version, or the latest published version by default. + if [ -n "${VERSION:-}" ]; then + DOWNLOAD_URL="https://github.com/stepchowfun/tagref/releases/download/v$VERSION/$FILENAME" + else + DOWNLOAD_URL="https://github.com/stepchowfun/tagref/releases/latest/download/$FILENAME" + fi + # Download the binary. - curl \ - "https://github.com/stepchowfun/tagref/releases/download/$RELEASE/$FILENAME" \ - -o "$SOURCE" -LSf || fail 'There was an error downloading the binary.' + curl "$DOWNLOAD_URL" -o "$SOURCE" -LSf || fail 'There was an error downloading the binary.' # Make it executable. chmod a+x "$SOURCE" || fail 'There was an error setting the permissions for the binary.'