forked from eooce/node-ws
-
Notifications
You must be signed in to change notification settings - Fork 0
183 lines (158 loc) · 4.68 KB
/
Copy pathBuild_go_binary.yml
File metadata and controls
183 lines (158 loc) · 4.68 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
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
name: Build-golang-binary
on:
workflow_dispatch:
jobs:
build-and-release:
runs-on: ubuntu-latest
permissions:
contents: write
strategy:
matrix:
include:
# Linux
- os: ubuntu-latest
goos: linux
goarch: 386
goarm: ""
filename: gows_linux_amd
- os: ubuntu-latest
goos: linux
goarch: amd64
goarm: ""
filename: gows_linux_amd64
- os: ubuntu-latest
goos: linux
goarch: arm
goarm: "6"
filename: gows_linux_arm
- os: ubuntu-latest
goos: linux
goarch: arm64
goarm: ""
filename: gows_linux_arm64
# FreeBSD
- os: ubuntu-latest
goos: freebsd
goarch: amd64
goarm: ""
filename: gows_freebsd_amd64
- os: ubuntu-latest
goos: freebsd
goarch: arm64
goarm: ""
filename: gows_freebsd_arm64
# Windows
- os: ubuntu-latest
goos: windows
goarch: amd64
goarm: ""
filename: gows_windows_amd64.exe
- os: ubuntu-latest
goos: windows
goarch: arm64
goarm: ""
filename: gows_windows_arm64.exe
# macOS (macOS jobs will run on macos runners in a real scenario, but for this workflow we'll use cross-compilation)
- os: macos-latest
goos: darwin
goarch: amd64
goarm: ""
filename: gows_macos_amd64
- os: macos-latest
goos: darwin
goarch: arm64
goarm: ""
filename: gows_macos_arm64
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: golang
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.24'
- name: Get dependencies
run: |
go mod tidy
go mod download
- name: Build binary
env:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
GOARM: ${{ matrix.goarm }}
CGO_ENABLED: 0
run: |
go build -ldflags="-s -w -extldflags -static" -o ${{ matrix.filename }} .
- name: Upload go.mod and go.sum
if: matrix.goos == 'linux' && matrix.goarch == 'amd64' # Only upload once
uses: actions/upload-artifact@v4
with:
name: go-dependencies
path: |
go.mod
go.sum
- name: Upload binary
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.filename }}
path: ${{ matrix.filename }}
release:
needs: build-and-release
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
ref: golang
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.24'
- name: Get dependencies
run: |
go mod tidy
go mod download
- name: Create binaries directory
run: mkdir -p ./binaries
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: ./temp-binaries
- name: Move binaries to correct location
run: |
find ./temp-binaries -type f -exec mv {} ./binaries/ \;
ls -la ./binaries/
- name: Download dependencies
uses: actions/download-artifact@v4
with:
name: go-dependencies
path: ./binaries
- name: Create Release
uses: softprops/action-gh-release@v2
with:
tag_name: gows-latest
name: "Gows Latest"
body: |
## Gows - Go WebSocket Proxy
This release includes binaries for multiple platforms:
- Linux: amd, amd64, arm, arm64
- FreeBSD: amd64, arm64
- Windows: amd64, arm64
- macOS: amd64, arm64
For usage instructions, please refer to the README.md
files: |
./binaries/gows_linux_amd
./binaries/gows_linux_amd64
./binaries/gows_linux_arm
./binaries/gows_linux_arm64
./binaries/gows_freebsd_amd64
./binaries/gows_freebsd_arm64
./binaries/gows_windows_amd64.exe
./binaries/gows_windows_arm64.exe
./binaries/gows_macos_amd64
./binaries/gows_macos_arm64
draft: false
prerelease: false