-
Notifications
You must be signed in to change notification settings - Fork 2
72 lines (63 loc) · 1.79 KB
/
build_and_deploy.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
name: Build and Deploy
on:
push:
branches:
- master # Trigger workflow on pushes to the 'main' branch
pull_request:
branches:
- master # Optional: Run on pull requests to 'main'
jobs:
build:
name: Build, Compress, and Deploy
runs-on: ubuntu-latest
container:
image: ubuntu:latest
options: --user root
strategy:
matrix:
os: [ linux, darwin, windows ]
arch: [ amd64, arm64 ]
env:
GO_VERSION: '1.23'
CGO_ENABLED: 0
steps:
- name: Install sudo package
run: |
echo "------------------------"
whoami
echo "------------------------"
# Step 1: Checkout the code
- name: Checkout Code
uses: actions/checkout@v4
- name: Install make
run: |
export DEBIAN_FRONTEND=noninteractive
apt update
apt-get install -y make ca-certificates jq zip git curl file nodejs npm
# Step 2: Set up Go environment
- name: Set up Go ${{ env.GO_VERSION }}
uses: actions/setup-go@v5
env:
ImageOS: ${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.goarm }}
with:
go-version: ${{ env.GO_VERSION }}
# Step 3: Build the application
- name: Build
env:
GOOS: ${{ matrix.os }}
GOARCH: ${{ matrix.arch }}
GOARM: ${{ matrix.goarm }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
ls -la
make binary
# Step 4: Release the package
- name: Release
env:
GOOS: ${{ matrix.os }}
GOARCH: ${{ matrix.arch }}
GOARM: ${{ matrix.goarm }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GIT_DISCOVERY_ACROSS_FILESYSTEM: 1
run: |
make release