From 2659a8cd90b69ea594abed09e82f1c305c7793b6 Mon Sep 17 00:00:00 2001 From: Stefan Haller Date: Sat, 5 Jul 2025 16:50:33 +0200 Subject: [PATCH 1/5] Update goreleaser to v2 --- .github/workflows/release.yml | 4 ++-- .goreleaser.yml | 24 +++++++++++++----------- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f64f700c9..ccf80245a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -130,10 +130,10 @@ jobs: go-version: 1.24.x - name: Run goreleaser - uses: goreleaser/goreleaser-action@v4 + uses: goreleaser/goreleaser-action@v6 with: distribution: goreleaser - version: v1.17.2 + version: v2 args: release --clean env: GITHUB_TOKEN: ${{secrets.GITHUB_API_TOKEN}} diff --git a/.goreleaser.yml b/.goreleaser.yml index dcdaf117f..2812468db 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -1,5 +1,5 @@ -# This is an example goreleaser.yaml file with some sane defaults. -# Make sure to check the documentation at http://goreleaser.com +version: 2 + builds: - env: - CGO_ENABLED=0 @@ -18,26 +18,28 @@ builds: - -s -w -X main.version={{.Version}} -X main.commit={{.Commit}} -X main.date={{.Date}} -X main.buildSource=binaryRelease archives: - - replacements: - darwin: Darwin - linux: Linux - windows: Windows - 386: 32-bit - amd64: x86_64 + - name_template: >- + {{- .ProjectName }}_ + {{- .Version }}_ + {{- .Os }}_ + {{- if eq .Arch "amd64" }}x86_64 + {{- else if eq .Arch "386" }}32-bit + {{- else if eq .Arch "arm" }}armv6 + {{- else }}{{ .Arch }}{{ end }} format_overrides: - goos: windows - format: zip + formats: [ zip ] checksum: name_template: 'checksums.txt' snapshot: - name_template: '{{ .Tag }}-next' + version_template: '{{ .Tag }}-next' changelog: use: github-native sort: asc brews: - # Repository to push the tap to. - tap: + repository: owner: jesseduffield name: homebrew-lazygit From 7ef8385f2e16b30ccb7462fc5b9a119611733b2e Mon Sep 17 00:00:00 2001 From: Stefan Haller Date: Sat, 5 Jul 2025 16:36:46 +0200 Subject: [PATCH 2/5] Set a default shell for all jobs Setting the shell to 'bash' turns on -e and -o pipefail, both of which are very desirable to have. https://github.com/actions/runner-images/issues/4459#issuecomment-965290856 --- .github/workflows/release.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ccf80245a..3fd2c4e07 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -22,6 +22,10 @@ on: required: true default: false +defaults: + run: + shell: bash + jobs: check-and-release: runs-on: ubuntu-latest From f735c6af175772020ba5890f5986c696077fe286 Mon Sep 17 00:00:00 2001 From: Stefan Haller Date: Sat, 5 Jul 2025 15:08:17 +0200 Subject: [PATCH 3/5] Make the release workflow run only from stefanhaller's fork As far as I can tell, this is the only way to make sure that releases show up as created by me. Also, we totally don't want it to run in other people's forks (although it would likely just have failed there, but still). The restriction only applies to scheduled runs; manually triggering the action is still possible from everywhere. There needs to be a personal access token named LAZYGIT_RELEASE_PAT configured on the repo for this to work, though. --- .github/workflows/release.yml | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3fd2c4e07..c9968d25c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -30,6 +30,12 @@ jobs: check-and-release: runs-on: ubuntu-latest steps: + - name: Check for correct repository + if: ${{ github.event_name != 'workflow_dispatch' && github.repository != 'stefanhaller/lazygit' }} + run: | + echo "Should only run in the stefanhaller/lazygit repository" + exit 1 + - name: Check for first Saturday of the month if: ${{ github.event_name != 'workflow_dispatch' }} run: | @@ -41,6 +47,8 @@ jobs: - name: Checkout Code uses: actions/checkout@v4 with: + repository: jesseduffield/lazygit + token: ${{ secrets.LAZYGIT_RELEASE_PAT }} fetch-depth: 0 - name: Get Latest Tag @@ -89,7 +97,7 @@ jobs: exit 1 fi env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GITHUB_TOKEN: ${{ secrets.LAZYGIT_RELEASE_PAT }} - name: Calculate next version run: | @@ -126,7 +134,7 @@ jobs: git tag ${{ env.new_tag }} git push origin ${{ env.new_tag }} env: - GITHUB_TOKEN: ${{ secrets.GITHUB_API_TOKEN }} + GITHUB_TOKEN: ${{ secrets.LAZYGIT_RELEASE_PAT }} - name: Setup Go uses: actions/setup-go@v5 @@ -140,11 +148,11 @@ jobs: version: v2 args: release --clean env: - GITHUB_TOKEN: ${{secrets.GITHUB_API_TOKEN}} + GITHUB_TOKEN: ${{secrets.LAZYGIT_RELEASE_PAT}} - name: Bump Homebrew formula uses: dawidd6/action-homebrew-bump-formula@v3 with: - token: ${{secrets.GITHUB_API_TOKEN}} + token: ${{secrets.LAZYGIT_RELEASE_PAT}} formula: lazygit tag: ${{env.new_tag}} From db3a23a11c1cf1f60f80e39f489017115812fab0 Mon Sep 17 00:00:00 2001 From: Stefan Haller Date: Sat, 5 Jul 2025 17:49:21 +0200 Subject: [PATCH 4/5] Create annotated tags They are preferable over lightweight tags because they carry information about who created them, and when. --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c9968d25c..88b7f46ae 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -131,7 +131,7 @@ jobs: run: | git config user.name "github-actions[bot]" git config user.email "github-actions[bot]@users.noreply.github.com" - git tag ${{ env.new_tag }} + git tag ${{ env.new_tag }} -a -m "Release ${{ env.new_tag }}" git push origin ${{ env.new_tag }} env: GITHUB_TOKEN: ${{ secrets.LAZYGIT_RELEASE_PAT }} From 05d1a7a804962c283d09564338ac7ad87ca67f8f Mon Sep 17 00:00:00 2001 From: Stefan Haller Date: Sun, 6 Jul 2025 12:07:32 +0200 Subject: [PATCH 5/5] Make it run at 8am instead of in the middle of the night This gives me a chance to react if necessary, e.g. by tweaking the release notes, or by deleting it again if something went wrong. --- .github/workflows/release.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 88b7f46ae..ecb3d08e0 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -2,9 +2,9 @@ name: Release on: schedule: - # Runs at 2:00 AM UTC on every Saturday + # Runs at 8:00 AM UTC on every Saturday # We'll check below if it's the first Saturday of the month, and fail if not - - cron: '0 2 * * 6' + - cron: '0 8 * * 6' # Allow manual triggering of the workflow workflow_dispatch: inputs: