Skip to content

Commit 1d80730

Browse files
authored
Update release workflow (#4703)
- **PR Description** Make the action run only in my fork, so that releases appear to be created by me. Also, update goreleaser to the latest version, and some other tweaks.
2 parents 67537c2 + 05d1a7a commit 1d80730

File tree

2 files changed

+34
-20
lines changed

2 files changed

+34
-20
lines changed

.github/workflows/release.yml

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ name: Release
22

33
on:
44
schedule:
5-
# Runs at 2:00 AM UTC on every Saturday
5+
# Runs at 8:00 AM UTC on every Saturday
66
# We'll check below if it's the first Saturday of the month, and fail if not
7-
- cron: '0 2 * * 6'
7+
- cron: '0 8 * * 6'
88
# Allow manual triggering of the workflow
99
workflow_dispatch:
1010
inputs:
@@ -22,10 +22,20 @@ on:
2222
required: true
2323
default: false
2424

25+
defaults:
26+
run:
27+
shell: bash
28+
2529
jobs:
2630
check-and-release:
2731
runs-on: ubuntu-latest
2832
steps:
33+
- name: Check for correct repository
34+
if: ${{ github.event_name != 'workflow_dispatch' && github.repository != 'stefanhaller/lazygit' }}
35+
run: |
36+
echo "Should only run in the stefanhaller/lazygit repository"
37+
exit 1
38+
2939
- name: Check for first Saturday of the month
3040
if: ${{ github.event_name != 'workflow_dispatch' }}
3141
run: |
@@ -37,6 +47,8 @@ jobs:
3747
- name: Checkout Code
3848
uses: actions/checkout@v4
3949
with:
50+
repository: jesseduffield/lazygit
51+
token: ${{ secrets.LAZYGIT_RELEASE_PAT }}
4052
fetch-depth: 0
4153

4254
- name: Get Latest Tag
@@ -85,7 +97,7 @@ jobs:
8597
exit 1
8698
fi
8799
env:
88-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
100+
GITHUB_TOKEN: ${{ secrets.LAZYGIT_RELEASE_PAT }}
89101

90102
- name: Calculate next version
91103
run: |
@@ -119,28 +131,28 @@ jobs:
119131
run: |
120132
git config user.name "github-actions[bot]"
121133
git config user.email "github-actions[bot]@users.noreply.github.com"
122-
git tag ${{ env.new_tag }}
134+
git tag ${{ env.new_tag }} -a -m "Release ${{ env.new_tag }}"
123135
git push origin ${{ env.new_tag }}
124136
env:
125-
GITHUB_TOKEN: ${{ secrets.GITHUB_API_TOKEN }}
137+
GITHUB_TOKEN: ${{ secrets.LAZYGIT_RELEASE_PAT }}
126138

127139
- name: Setup Go
128140
uses: actions/setup-go@v5
129141
with:
130142
go-version: 1.24.x
131143

132144
- name: Run goreleaser
133-
uses: goreleaser/goreleaser-action@v4
145+
uses: goreleaser/goreleaser-action@v6
134146
with:
135147
distribution: goreleaser
136-
version: v1.17.2
148+
version: v2
137149
args: release --clean
138150
env:
139-
GITHUB_TOKEN: ${{secrets.GITHUB_API_TOKEN}}
151+
GITHUB_TOKEN: ${{secrets.LAZYGIT_RELEASE_PAT}}
140152

141153
- name: Bump Homebrew formula
142154
uses: dawidd6/action-homebrew-bump-formula@v3
143155
with:
144-
token: ${{secrets.GITHUB_API_TOKEN}}
156+
token: ${{secrets.LAZYGIT_RELEASE_PAT}}
145157
formula: lazygit
146158
tag: ${{env.new_tag}}

.goreleaser.yml

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
# This is an example goreleaser.yaml file with some sane defaults.
2-
# Make sure to check the documentation at http://goreleaser.com
1+
version: 2
2+
33
builds:
44
- env:
55
- CGO_ENABLED=0
@@ -18,26 +18,28 @@ builds:
1818
- -s -w -X main.version={{.Version}} -X main.commit={{.Commit}} -X main.date={{.Date}} -X main.buildSource=binaryRelease
1919

2020
archives:
21-
- replacements:
22-
darwin: Darwin
23-
linux: Linux
24-
windows: Windows
25-
386: 32-bit
26-
amd64: x86_64
21+
- name_template: >-
22+
{{- .ProjectName }}_
23+
{{- .Version }}_
24+
{{- .Os }}_
25+
{{- if eq .Arch "amd64" }}x86_64
26+
{{- else if eq .Arch "386" }}32-bit
27+
{{- else if eq .Arch "arm" }}armv6
28+
{{- else }}{{ .Arch }}{{ end }}
2729
format_overrides:
2830
- goos: windows
29-
format: zip
31+
formats: [ zip ]
3032
checksum:
3133
name_template: 'checksums.txt'
3234
snapshot:
33-
name_template: '{{ .Tag }}-next'
35+
version_template: '{{ .Tag }}-next'
3436
changelog:
3537
use: github-native
3638
sort: asc
3739
brews:
3840
-
3941
# Repository to push the tap to.
40-
tap:
42+
repository:
4143
owner: jesseduffield
4244
name: homebrew-lazygit
4345

0 commit comments

Comments
 (0)