Skip to content

Commit 754bb69

Browse files
DCodeBotdector
andcommitted
ci: add trunk-triggered latest release workflow
Co-authored-by: D <[email protected]>
1 parent d4209e7 commit 754bb69

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: release-latest
2+
3+
on:
4+
push:
5+
branches:
6+
- trunk
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
build-and-release:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v4
18+
19+
- name: Setup Go
20+
uses: actions/setup-go@v5
21+
with:
22+
go-version-file: go.mod
23+
24+
- name: Build linux amd64 binary
25+
run: |
26+
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 \
27+
go build \
28+
-trimpath \
29+
-ldflags "-s -w -X 'github.com/dector/ror/internal/env.version=latest' -X 'github.com/dector/ror/internal/env.commit=${GITHUB_SHA}' -X 'github.com/dector/ror/internal/env.time=$(date -u +%Y-%m-%dT%H:%M:%SZ)'" \
30+
-o ./ror \
31+
./cmd/ror
32+
33+
tar -czf ror-linux-amd64.tar.gz ror
34+
35+
- name: Replace latest release
36+
env:
37+
GH_TOKEN: ${{ github.token }}
38+
run: |
39+
if gh release view latest >/dev/null 2>&1; then
40+
gh release delete latest --cleanup-tag --yes
41+
fi
42+
43+
gh release create latest \
44+
ror-linux-amd64.tar.gz \
45+
--title "latest" \
46+
--notes "Automated build from ${GITHUB_SHA}" \
47+
--latest

0 commit comments

Comments
 (0)