Skip to content

Commit 0aaf29d

Browse files
authoredAug 23, 2024
Binary release GitHub action (#133)
1 parent f856ae1 commit 0aaf29d

File tree

1 file changed

+55
-0
lines changed

1 file changed

+55
-0
lines changed
 

‎.github/workflows/release-binary.yml

+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: Release Binaries
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
tags:
7+
- 'v*.*.*'
8+
9+
jobs:
10+
build:
11+
name: Build and Upload Release Assets
12+
runs-on: ubuntu-latest
13+
container: golang:1.18-bullseye
14+
strategy:
15+
matrix:
16+
goosarch:
17+
- "linux/amd64"
18+
- "linux/arm64"
19+
- "windows/amd64"
20+
- "darwin/amd64"
21+
- "darwin/arm64"
22+
env:
23+
GO111MODULE: on
24+
CGO_ENABLED: 0
25+
steps:
26+
- name: Checkout code
27+
uses: actions/checkout@v2
28+
- name: Build ${{ matrix.goosarch }} binary
29+
run: |
30+
apt update
31+
apt -y install zip
32+
33+
export GOOSARCH=${{ matrix.goosarch }}
34+
export GOOS=${GOOSARCH%/*}
35+
export GOARCH=${GOOSARCH#*/}
36+
37+
mkdir -p artifacts
38+
39+
if [ "$GOOS" = "windows" ]; then
40+
go build -o cql-proxy.exe
41+
zip -vr cql-proxy-${GOOS}-${GOARCH}-${{ github.ref_name }}.zip cql-proxy.exe LICENSE
42+
sha256sum cql-proxy-${GOOS}-${GOARCH}-${{ github.ref_name }}.zip | cut -d ' ' -f 1 > cql-proxy-${GOOS}-${GOARCH}-${{ github.ref_name }}-sha256.txt
43+
else
44+
go build -o cql-proxy
45+
tar cvfz cql-proxy-${GOOS}-${GOARCH}-${{ github.ref_name }}.tgz cql-proxy LICENSE
46+
sha256sum cql-proxy-${GOOS}-${GOARCH}-${{ github.ref_name }}.tgz | cut -d ' ' -f 1 > cql-proxy-${GOOS}-${GOARCH}-${{ github.ref_name }}-sha256.txt
47+
fi
48+
49+
mv cql-proxy-* artifacts
50+
- name: Upload ${{ matrix.goosarch }} binaries
51+
uses: softprops/action-gh-release@v1
52+
with:
53+
name: ${{ github.ref_name }}
54+
files: |
55+
artifacts/*

0 commit comments

Comments
 (0)