Skip to content

Commit e442aa7

Browse files
committed
ci: add release workflow
Add GitHub Actions workflow for automated releases: - Create releases when pushing version tags (v*) - Build cbcopy and cbcopy_helper binaries - Run unit tests before release - Package binaries into tar.gz with version and platform info - Auto-generate release notes The release artifacts will be named as: cbcopy-<version>-linux-amd64.tar.gz
1 parent 6fc74a8 commit e442aa7

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed

.github/workflows/release.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
jobs:
9+
goreleaser:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout
13+
uses: actions/checkout@v4
14+
with:
15+
fetch-depth: 0
16+
17+
- name: Set up Go
18+
uses: actions/setup-go@v4
19+
with:
20+
go-version: 1.19
21+
22+
- name: Build binaries
23+
run: make
24+
25+
- name: Run tests
26+
run: make unit
27+
28+
- name: Package binaries
29+
run: |
30+
VERSION=${GITHUB_REF#refs/tags/v}
31+
PACKAGE_NAME="cbcopy-${VERSION}-linux-amd64"
32+
33+
mkdir -p release/${PACKAGE_NAME}
34+
35+
cp cbcopy cbcopy_helper release/${PACKAGE_NAME}/
36+
cp README.md LICENSE release/${PACKAGE_NAME}/ 2>/dev/null || true
37+
38+
cd release && tar -czf ${PACKAGE_NAME}.tar.gz ${PACKAGE_NAME}/
39+
40+
- name: Create Release
41+
id: create_release
42+
uses: softprops/action-gh-release@v1
43+
with:
44+
files: release/*.tar.gz
45+
draft: false
46+
prerelease: false
47+
generate_release_notes: true
48+
env:
49+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)