From e718b4b63e87500424637037de04b2e89460dd0b Mon Sep 17 00:00:00 2001 From: Stefan Haller Date: Fri, 16 Oct 2026 14:11:57 +0200 Subject: [PATCH 1/2] Check that the fork's release.yml matches upstream's Releases run the release workflow of the stefanhaller/lazygit fork, but build the code of jesseduffield/lazygit. If the fork's master is behind, its copy of release.yml can differ from upstream's, and the release runs with outdated steps. This may only show up after the new tag has already been pushed. Stop the release right after checking out the code if the running release.yml differs from the one on jesseduffield/lazygit's master. Compare with master rather than with the branch being released. A patch release from a branch off an older tag carries an older release.yml, and it should still be released with the current workflow. This means that changes to release.yml can no longer be tried out in the fork before they land upstream. Co-Authored-By: Claude Opus 5.5 (1M context) --- .github/workflows/release.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 85426e6d5..4fd637aec 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -58,6 +58,18 @@ jobs: token: ${{ secrets.LAZYGIT_RELEASE_PAT }} fetch-depth: 0 + - name: Check that release.yml is up to date + run: | + # This workflow runs in a fork, but releases jesseduffield/lazygit, so + # its release.yml must match the one on jesseduffield/lazygit's master. + git fetch --quiet "https://github.com/$GITHUB_REPOSITORY" "$GITHUB_WORKFLOW_SHA" + + if ! git diff --quiet "$GITHUB_WORKFLOW_SHA" origin/master -- .github/workflows/release.yml; then + echo "Error: release.yml differs from the one on jesseduffield/lazygit's master." + echo "Update $GITHUB_REPOSITORY from there and run the workflow again." + exit 1 + fi + - name: Get Latest Tag run: | latest_tag=$(git describe --tags --abbrev=0 || echo "v0.0.0") From 5858bb7193ef21e6ad4dffdcc736ea931b951926 Mon Sep 17 00:00:00 2001 From: Stefan Haller Date: Fri, 16 Oct 2026 14:23:10 +0200 Subject: [PATCH 2/2] Take the Go version for releases from go.mod release.yml installs a fixed Go version for building a release, and it must match the release.yml on master. A patch release from a branch off an older tag is therefore built with master's Go version, not with the one that branch uses. For example, once master moves to Go 1.27, a v0.66.3 built from a branch off v0.66.2 would no longer run on macOS 12, although v0.66.2 does. Read the version from the go line of the checked-out go.mod instead, and add ".x" so that setup-go installs the latest patch release. setup-go's go-version-file input can't do this; for "go 1.26.0" it installs exactly 1.26.0. Read the version before pushing the tag, so that a go.mod without a go line stops the release early. This also removes release.yml from the files to edit when updating Go. Co-Authored-By: Claude Opus 5.5 (1M context) --- .github/workflows/release.yml | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4fd637aec..102000f0b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -161,6 +161,24 @@ jobs: echo "New tag: $new_tag" echo "new_tag=$new_tag" >> $GITHUB_ENV + - name: Get Go version + run: | + # Take the Go version from the go.mod of the code being released, so + # that a patch release from a branch off an older tag is built with + # that branch's Go version, not with master's. + # + # Turn "go 1.26.0" into "1.26.x" so that setup-go installs the latest + # patch release. With go-version-file, it would install exactly 1.26.0. + go_version=$(sed -n 's/^go \([0-9]*\.[0-9]*\).*/\1.x/p' go.mod) + + if ! [[ $go_version =~ ^[0-9]+\.[0-9]+\.x$ ]]; then + echo "Error: Could not read the go version from go.mod" + exit 1 + fi + + echo "Go version: $go_version" + echo "go_version=$go_version" >> $GITHUB_ENV + - name: Create and Push Tag env: NEW_TAG: ${{ env.new_tag }} @@ -174,7 +192,7 @@ jobs: - name: Setup Go uses: actions/setup-go@v7 with: - go-version: 1.26.x + go-version: ${{ env.go_version }} - name: Run goreleaser uses: goreleaser/goreleaser-action@f06c13b6b1a9625abc9e6e439d9c05a8f2190e94 # v7.2.3