Skip to content

Commit 9d17679

Browse files
committed
Update release workflow to use GitHub Releases and tag versioning
1 parent 6d2859e commit 9d17679

3 files changed

Lines changed: 20 additions & 13 deletions

File tree

.github/workflows/release.yml

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
name: Build and Upload Go Binary
1+
name: Build and Release Go Binary
22

33
on:
44
push:
5-
branches: [main]
5+
tags:
6+
- 'v*'
67

78
jobs:
89
build:
@@ -17,13 +18,11 @@ jobs:
1718

1819
- name: Build binary
1920
run: |
20-
mkdir -p releases
21-
go build -o releases/commit-msg-go commit-msg.go
21+
go build -o commit-msg-go commit-msg.go
2222
23-
- name: Commit and push binary
24-
run: |
25-
git config user.name "github-actions[bot]"
26-
git config user.email "github-actions[bot]@users.noreply.github.com"
27-
git add releases/commit-msg-go
28-
git commit -m "ci: update commit-msg-go binary [skip ci]" || exit 0
29-
git push
23+
- name: Upload Release Asset
24+
uses: softprops/action-gh-release@v2
25+
with:
26+
files: commit-msg-go
27+
env:
28+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Makefile

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,12 @@ install-hook:
1111
curl -fsSL https://raw.githubusercontent.com/inem/dotdotdot/main/install.sh | sh
1212

1313
build:
14-
go build -o release/commit-msg-go commit-msg.go
14+
go build -o release/commit-msg-go commit-msg.go
15+
16+
release
17+
git tag v0.0.$(ARGS)
18+
git push origin v0.0.$(ARGS)
19+
20+
ARGS = $(filter-out $@,$(MAKECMDGOALS))
21+
%:
22+
@:

install.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ curl -fsSL "$HOOK_URL" -o "$HOOK_PATH"
1616
chmod +x "$HOOK_PATH"
1717
echo "Hook installed to $HOOK_PATH"
1818

19-
echo "Downloading Go binary..."
19+
echo "Downloading Go binary from GitHub Releases..."
2020
curl -fsSL "$BIN_URL" -o "$BIN_PATH"
2121
chmod +x "$BIN_PATH"
2222
echo "Binary installed to $BIN_PATH"

0 commit comments

Comments
 (0)