Skip to content

Commit fcf48c4

Browse files
committed
Improve release workflow
1) the cron schedule was wrong: it was doing every saturday, rather than the first saturday of each month. 2) It wasn't triggering a deploy despite pushing a tag because clearly github doesn't want that to happen. Now it triggers a deploy, and it also allows triggering from the UI, letting you specify minor/patch bump and whether to ignore blocking PRs/issues. As such I'm removing support for the old method of pushing the tag. The new way is the only way.
1 parent 2ceecad commit fcf48c4

File tree

2 files changed

+57
-44
lines changed

2 files changed

+57
-44
lines changed

Diff for: .github/workflows/cd.yml

-35
This file was deleted.

Diff for: .github/workflows/release.yml

+57-9
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,32 @@
1-
name: Automated Release
1+
name: Release
22

33
on:
44
schedule:
55
# Runs at 2:00 AM UTC on the first Saturday of every month
66
- cron: '0 2 1-7 * 6'
7-
workflow_dispatch: # Allow manual triggering of the workflow
7+
# Allow manual triggering of the workflow
8+
workflow_dispatch:
9+
inputs:
10+
version_bump:
11+
description: 'Version bump type'
12+
type: choice
13+
required: true
14+
default: 'patch'
15+
options:
16+
- minor
17+
- patch
18+
ignore_blocks:
19+
description: 'Ignore blocking PRs/issues'
20+
type: boolean
21+
required: true
22+
default: false
823

924
jobs:
1025
check-and-release:
1126
runs-on: ubuntu-latest
12-
1327
steps:
1428
- name: Checkout Code
15-
uses: actions/checkout@v3
29+
uses: actions/checkout@v4
1630
with:
1731
fetch-depth: 0
1832

@@ -30,6 +44,7 @@ jobs:
3044
fi
3145
3246
- name: Check for Blocking Issues/PRs
47+
if: ${{ !inputs.ignore_blocks }}
3348
id: check_blocks
3449
run: |
3550
gh auth setup-git
@@ -60,18 +75,51 @@ jobs:
6075
- name: Calculate next version
6176
run: |
6277
echo "Latest tag: ${{ env.latest_tag }}"
63-
IFS='.' read -r major minor patch <<< "${{ env.latest_tag }}"
64-
new_minor=$((minor + 1))
65-
new_tag="$major.$new_minor.0"
78+
IFS='.' read -r major minor patch <<< "${env.latest_tag#v}"
79+
80+
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
81+
if [[ "${{ inputs.version_bump }}" == "patch" ]]; then
82+
patch=$((patch + 1))
83+
else
84+
minor=$((minor + 1))
85+
patch=0
86+
fi
87+
else
88+
# Default behavior for scheduled runs
89+
minor=$((minor + 1))
90+
patch=0
91+
fi
92+
93+
new_tag="v$major.$minor.$patch"
6694
echo "New tag: $new_tag"
6795
echo "new_tag=$new_tag" >> $GITHUB_ENV
6896
69-
# This will trigger a deploy via .github/workflows/cd.yml
70-
- name: Push New Tag
97+
- name: Create and Push Tag
7198
run: |
7299
git config user.name "github-actions[bot]"
73100
git config user.email "github-actions[bot]@users.noreply.github.com"
74101
git tag ${{ env.new_tag }}
75102
git push origin ${{ env.new_tag }}
76103
env:
77104
GITHUB_TOKEN: ${{ secrets.GITHUB_API_TOKEN }}
105+
106+
- name: Setup Go
107+
uses: actions/setup-go@v5
108+
with:
109+
go-version: 1.22.x
110+
111+
- name: Run goreleaser
112+
uses: goreleaser/goreleaser-action@v4
113+
with:
114+
distribution: goreleaser
115+
version: v1.17.2
116+
args: release --clean
117+
env:
118+
GITHUB_TOKEN: ${{secrets.GITHUB_API_TOKEN}}
119+
120+
- name: Bump Homebrew formula
121+
uses: dawidd6/action-homebrew-bump-formula@v3
122+
with:
123+
token: ${{secrets.GITHUB_API_TOKEN}}
124+
formula: lazygit
125+
tag: ${{env.new_tag}}

0 commit comments

Comments
 (0)