1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-08-08 22:36:49 +02:00

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.
This commit is contained in:
Stefan Haller
2025-07-06 12:31:00 +02:00
committed by GitHub
2 changed files with 34 additions and 20 deletions

View File

@ -2,9 +2,9 @@ name: Release
on: on:
schedule: 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 # 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 # Allow manual triggering of the workflow
workflow_dispatch: workflow_dispatch:
inputs: inputs:
@ -22,10 +22,20 @@ on:
required: true required: true
default: false default: false
defaults:
run:
shell: bash
jobs: jobs:
check-and-release: check-and-release:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: 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 - name: Check for first Saturday of the month
if: ${{ github.event_name != 'workflow_dispatch' }} if: ${{ github.event_name != 'workflow_dispatch' }}
run: | run: |
@ -37,6 +47,8 @@ jobs:
- name: Checkout Code - name: Checkout Code
uses: actions/checkout@v4 uses: actions/checkout@v4
with: with:
repository: jesseduffield/lazygit
token: ${{ secrets.LAZYGIT_RELEASE_PAT }}
fetch-depth: 0 fetch-depth: 0
- name: Get Latest Tag - name: Get Latest Tag
@ -85,7 +97,7 @@ jobs:
exit 1 exit 1
fi fi
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.LAZYGIT_RELEASE_PAT }}
- name: Calculate next version - name: Calculate next version
run: | run: |
@ -119,10 +131,10 @@ jobs:
run: | run: |
git config user.name "github-actions[bot]" git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com" 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 }} git push origin ${{ env.new_tag }}
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_API_TOKEN }} GITHUB_TOKEN: ${{ secrets.LAZYGIT_RELEASE_PAT }}
- name: Setup Go - name: Setup Go
uses: actions/setup-go@v5 uses: actions/setup-go@v5
@ -130,17 +142,17 @@ jobs:
go-version: 1.24.x go-version: 1.24.x
- name: Run goreleaser - name: Run goreleaser
uses: goreleaser/goreleaser-action@v4 uses: goreleaser/goreleaser-action@v6
with: with:
distribution: goreleaser distribution: goreleaser
version: v1.17.2 version: v2
args: release --clean args: release --clean
env: env:
GITHUB_TOKEN: ${{secrets.GITHUB_API_TOKEN}} GITHUB_TOKEN: ${{secrets.LAZYGIT_RELEASE_PAT}}
- name: Bump Homebrew formula - name: Bump Homebrew formula
uses: dawidd6/action-homebrew-bump-formula@v3 uses: dawidd6/action-homebrew-bump-formula@v3
with: with:
token: ${{secrets.GITHUB_API_TOKEN}} token: ${{secrets.LAZYGIT_RELEASE_PAT}}
formula: lazygit formula: lazygit
tag: ${{env.new_tag}} tag: ${{env.new_tag}}

View File

@ -1,5 +1,5 @@
# This is an example goreleaser.yaml file with some sane defaults. version: 2
# Make sure to check the documentation at http://goreleaser.com
builds: builds:
- env: - env:
- CGO_ENABLED=0 - 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 - -s -w -X main.version={{.Version}} -X main.commit={{.Commit}} -X main.date={{.Date}} -X main.buildSource=binaryRelease
archives: archives:
- replacements: - name_template: >-
darwin: Darwin {{- .ProjectName }}_
linux: Linux {{- .Version }}_
windows: Windows {{- .Os }}_
386: 32-bit {{- if eq .Arch "amd64" }}x86_64
amd64: x86_64 {{- else if eq .Arch "386" }}32-bit
{{- else if eq .Arch "arm" }}armv6
{{- else }}{{ .Arch }}{{ end }}
format_overrides: format_overrides:
- goos: windows - goos: windows
format: zip formats: [ zip ]
checksum: checksum:
name_template: 'checksums.txt' name_template: 'checksums.txt'
snapshot: snapshot:
name_template: '{{ .Tag }}-next' version_template: '{{ .Tag }}-next'
changelog: changelog:
use: github-native use: github-native
sort: asc sort: asc
brews: brews:
- -
# Repository to push the tap to. # Repository to push the tap to.
tap: repository:
owner: jesseduffield owner: jesseduffield
name: homebrew-lazygit name: homebrew-lazygit