-
Notifications
You must be signed in to change notification settings - Fork 0
58 lines (50 loc) · 1.57 KB
/
binary-release.yaml
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
name: Build and Commit Go Binaries
on:
push:
branches:
- main
paths-ignore:
- 'shuffle_email_rules/lib/binaries/**'
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
goos: [linux, windows, darwin]
goarch: [amd64, arm64]
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: '1.22' # Replace with your Go version
# - name: Set up GCC
# uses: egor-tensin/setup-gcc@v1
# with:
# version: latest
# platform: ${{ matrix.goarch }}
- name: Build binary
run: |
cd shuffle_email_rules/lib/
go mod tidy
mkdir -p build/${{ matrix.goos }}_${{ matrix.goarch }}
go build -v -o build/libshuffleemail_${{ matrix.goos }}_${{ matrix.goarch }} -buildmode=c-shared
env:
CGO_ENABLED: 1
# GOOS: ${{ matrix.goos }}
# GOARCH: ${{ matrix.goarch }}
- name: Commit binaries
run: |
cd shuffle_email_rules/lib/
git config --global user.name 'github-actions'
git config --global user.email '[email protected]'
git config pull.rebase false # merge
mkdir -p binaries/
mv build/libshuffleemail_${{ matrix.goos }}_${{ matrix.goarch }} binaries/
git add binaries/
git commit -m "Add compiled binaries for ${{ matrix.goos }} - ${{ matrix.goarch }}"
# sleep for a random amount of time between 1 and 10 seconds
sleep $((1 + RANDOM % 20))
git pull
git push