From 5bac7aa57707e1c9ab881a178670471cab7816ce Mon Sep 17 00:00:00 2001 From: Michael Housh Date: Thu, 26 Dec 2024 14:51:51 -0500 Subject: [PATCH] feat: Adds release file for a reminder of whats needed, bumps our current version. --- Release.md | 24 ++++++++++++++++++++++++ Sources/bump-version/Version.swift | 2 +- justfile | 18 +++++++++++++----- 3 files changed, 38 insertions(+), 6 deletions(-) create mode 100644 Release.md diff --git a/Release.md b/Release.md new file mode 100644 index 0000000..756dbdc --- /dev/null +++ b/Release.md @@ -0,0 +1,24 @@ +# Release Workflow Steps + +This is a reminder of the steps used to create a release and update the homebrew formula. + +> Note: These steps apply to the version hosted on `gitea`, on `github` more of these steps can be +> automated in `ci`, but there are no `macOS` host runners currently in `gitea`, so the bottles need +> built on `macOS`. + +1. Update the version in `Sources/hpa/Version.swift`. +1. Tag the commit with the next version tag. +1. Push the tagged commit, this will initiate the release being created. +1. Get the `sha` of the `*.tar.gz` in the release. + 1. `just get-release-sha` +1. Update the homebrew formula url, sha256, and version at top of the homebrew formula. + 1. `cd $(brew --repo michael/formula)` +1. Build and generate a homebrew bottle. + 1. `just bottle` +1. Update the `bottle do` section of homebrew formula with output during previous step. + 1. Also make sure the `root_url` in the bottle section points to the new release. +1. Upload the bottle `*.tar.gz` file that was created to the release. +1. Generate a pull-request to the formula repo. +1. Generate a pull-request to this repo to merge into main. +1. Remove the bottle from current directory. + 1. `just remove-bottles` diff --git a/Sources/bump-version/Version.swift b/Sources/bump-version/Version.swift index 847b6de..b4cd899 100644 --- a/Sources/bump-version/Version.swift +++ b/Sources/bump-version/Version.swift @@ -1,2 +1,2 @@ // Do not set this variable, it is set during the build process. -let VERSION: String? = "0.1.1" +let VERSION: String? = "0.3.0" diff --git a/justfile b/justfile index 850ad66..583b56a 100644 --- a/justfile +++ b/justfile @@ -5,7 +5,8 @@ docker_tag := "test" tap_url := "https://git.housh.dev/michael/homebrew-formula" tap := "michael/formula" formula := "bump-version" -release_base_url := "https://git.housh.dev/michael/bump-version/archive" +release_base_url := "https://git.housh.dev/michael/swift-bump-version/archive" +version := "$(git describe --tags --exact-match)" [private] default: @@ -26,7 +27,8 @@ build configuration="debug": --configuration {{configuration}} \ --product {{product}} -alias b := build +# Bump our version of the command-line tool. +bump-version *ARGS: (run "bump" ARGS) # Build a docker image. build-docker configuration="debug": @@ -43,7 +45,9 @@ clean: # Clean and build. clean-build configuration="debug": clean (build configuration) -alias cb := clean-build +# Remove bottles +remove-bottles: + rm -rf *.gz # Test locally. test *ARGS: @@ -53,13 +57,17 @@ test *ARGS: test-docker: build-docker @docker run --rm {{docker_image}}:{{docker_tag}} +# Run tests in docker without building a new image. test-docker-without-building: @docker run --rm {{docker_image}}:{{docker_tag}} swift test +# Show the current git-tag version. +echo-version: + @echo "VERSION: {{version}}" + # Get the sha256 sum of the release and copy to clipboard. get-release-sha prefix="": (build "release") - version=$(.build/release/hpa --version) && \ - url="{{release_base_url}}/{{prefix}}${version}.tar.gz" && \ + url="{{release_base_url}}/{{prefix}}${version}.tar.gz" && \ sha=$(curl "$url" | shasum -a 256) && \ stripped="${sha% *}" && \ echo "$stripped" | pbcopy && \