-
Notifications
You must be signed in to change notification settings - Fork 16
51 lines (43 loc) · 1.23 KB
/
Copy pathrelease.yml
File metadata and controls
51 lines (43 loc) · 1.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
name: Build and Release
on:
push:
tags:
- 'v*'
jobs:
build:
name: Build for multiple platforms
runs-on: ubuntu-latest
strategy:
matrix:
goos: [linux, windows, darwin]
goarch: [amd64, arm64]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.21'
- name: Build
run: |
mkdir -p dist
VERSION=${GITHUB_REF#refs/tags/}
NAME=transbridge
OUTNAME=${NAME}-${VERSION}-${{ matrix.goos }}-${{ matrix.goarch }}
if [ "${{ matrix.goos }}" = "windows" ]; then
OUTNAME="$OUTNAME.exe"
fi
GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} go build -o dist/$OUTNAME .
- name: Archive as .tar.gz
run: |
cd dist
for f in *; do
tar -czf "${f%.*}.tar.gz" "$f"
done
- name: Upload Release Assets
uses: softprops/action-gh-release@v2
with:
files: dist/*.tar.gz
generate_release_notes: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}