diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1d61b9e..6f3a69a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -11,8 +11,41 @@ permissions: contents: write jobs: + verify-version: + name: Verify tag matches committed versions + if: startsWith(github.ref, 'refs/tags/') + runs-on: ubuntu-latest + timeout-minutes: 5 + steps: + - name: Checkout code + uses: actions/checkout@v6 + + - name: Check Cargo.toml and main.go versions match tag + run: | + tag="${GITHUB_REF_NAME}" + cargo_version=$(cargo metadata --no-deps --format-version 1 \ + | jq -r '.packages[] | select(.name == "componentize-go") | .version') + go_release=$(sed -nE 's/^[[:space:]]*release := "([^"]+)"/\1/p' main.go) + + echo "tag: $tag" + echo "Cargo.toml: v$cargo_version" + echo "main.go: $go_release" + + status=0 + if [ "v$cargo_version" != "$tag" ]; then + echo "::error file=Cargo.toml::workspace.package.version (v$cargo_version) does not match tag $tag" + status=1 + fi + if [ "$go_release" != "$tag" ]; then + echo "::error file=main.go::release ($go_release) does not match tag $tag" + status=1 + fi + exit $status + build: name: Build ${{ matrix.target }} + needs: verify-version + if: ${{ !failure() && !cancelled() }} runs-on: ${{ matrix.os }} timeout-minutes: 30 strategy: diff --git a/Cargo.lock b/Cargo.lock index 3aa0dbe..d2768f3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -313,7 +313,7 @@ dependencies = [ [[package]] name = "componentize-go" -version = "0.4.3" +version = "0.5.1" dependencies = [ "anyhow", "bzip2", @@ -2195,7 +2195,7 @@ dependencies = [ [[package]] name = "tests" -version = "0.4.3" +version = "0.5.1" dependencies = [ "anyhow", "bzip2", diff --git a/Cargo.toml b/Cargo.toml index 4da9f40..d8b5456 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -19,7 +19,7 @@ reqwest = { version = "0.13.4", features = ["blocking"] } tar = "0.4.46" [workspace.package] -version = "0.4.3" +version = "0.5.1" edition = "2024" [workspace.lints.clippy] diff --git a/go.mod b/go.mod index ee83d90..e783282 100644 --- a/go.mod +++ b/go.mod @@ -8,3 +8,5 @@ require ( ) require golang.org/x/sys v0.37.0 // indirect + +retract v0.5.0 // manifest versions not bumped; use v0.5.1 diff --git a/main.go b/main.go index 1bd1066..9875a8e 100644 --- a/main.go +++ b/main.go @@ -24,7 +24,7 @@ import ( // Although `componentize-go` is written in Rust, we can use this wrapper to // make it available using e.g. `go install` and/or `go tool`. func main() { - release := "v0.4.3" + release := "v0.5.1" directories := userdirs.ForApp( "componentize-go",