-
Notifications
You must be signed in to change notification settings - Fork 44
83 lines (69 loc) · 2.07 KB
/
build.yml
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
name: Release Prebuilt Binaries
on:
push:
paths:
- state/version.txt
branches:
- main
workflow_dispatch:
jobs:
build-amd64:
runs-on: ubuntu-latest
strategy:
matrix:
architecture: [amd64]
steps:
- uses: actions/checkout@v3
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y gcc golang
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.22'
- name: Build
run: GOARCH=amd64 GOOS=linux go build -ldflags '-s -w' -o watgbridge_linux_amd64 .
- name: Get Project Version
id: get_version
run: |
echo "version=$(cat state/version.txt | tr -d '\n')" >> $GITHUB_OUTPUT
- name: Create Release for amd64
if: always()
uses: softprops/action-gh-release@v1
with:
files: ./watgbridge_linux_amd64
tag_name: v${{ steps.get_version.outputs.version }}
name: Release ${{ steps.get_version.outputs.version }}
env:
GITHUB_TOKEN: ${{ github.token }}
build-arm64:
runs-on: ubuntu-latest
strategy:
matrix:
architecture: [arm64]
steps:
- uses: actions/checkout@v3
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y golang gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.22'
- name: Build
run: CGO_ENABLED=1 CC=aarch64-linux-gnu-gcc CXX=aarch64-linux-gnu-g++ GOARCH=arm64 GOOS=linux go build -ldflags '-s -w' -o watgbridge_linux_aarch64 .
- name: Get Project Version
id: get_version
run: |
echo "version=$(cat state/version.txt | tr -d '\n')" >> $GITHUB_OUTPUT
- name: Create Release for arm64
if: always()
uses: softprops/action-gh-release@v1
with:
files: ./watgbridge_linux_aarch64
tag_name: v${{ steps.get_version.outputs.version }}
name: Release ${{ steps.get_version.outputs.version }}
env:
GITHUB_TOKEN: ${{ github.token }}