This repository has been archived by the owner on Nov 5, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
84 lines (68 loc) · 1.94 KB
/
build.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
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
84
name: Build
on:
workflow_call:
secrets:
SECRET:
required: true
jobs:
build-linux:
name: "Build for linux"
runs-on: ubuntu-latest
container:
image: golang:alpine
steps:
- name: "Install packages"
run: apk update && apk add --no-cache libpcap-dev musl-dev gcc go
- uses: actions/checkout@v3
- name: "Create output path"
run: mkdir ./output
- name: "Load secret"
env:
SECRET: ${{ secrets.SECRET }}
run: |
echo "$SECRET" > ./src/excel/secret.json
echo "$SECRET" > ./src/excel_adapter/internals/secret.json
- name: "Build for amd46 (64 bit)"
working-directory: ./src
env:
CGO_ENABLED: 1
GOARCH: amd64
GOOS: linux
run: |
go build -ldflags '-linkmode external -extldflags "-static"' -o ../output/backend-linux-64
- name: "Uplaod artifacts"
uses: actions/upload-artifact@v2
with:
name: backend-linux
path: ./output/backend-linux-64
build-windows:
name: "Build for windows"
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- name: "Setup Go"
uses: actions/setup-go@v4
with:
go-version: "1.20"
cache-dependency-path: ".\\src\\go.sum"
- name: "Load secret"
env:
SECRET: ${{ secrets.SECRET }}
run: |
echo "$env:SECRET" > .\src\excel\secret.json
echo "$env:SECRET" > .\src\excel_adapter\internals\secret.json
- name: "Create output path"
run: mkdir .\output
- name: "Build for amd46 (64 bit)"
working-directory: .\src
env:
CGO_ENABLED: 1
GOARCH: amd64
GOOS: windows
run: |
go build -ldflags '-linkmode external -extldflags "-static"' -o ..\output\backend-windows-64.exe
- name: "Uplaod artifacts"
uses: actions/upload-artifact@v2
with:
name: backend-windows
path: ./output/backend-windows-64.exe