-
Notifications
You must be signed in to change notification settings - Fork 1
49 lines (40 loc) · 1.23 KB
/
main.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
name: Build and Compress Go Application
on:
workflow_dispatch:
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-latest
ext: ""
- os: windows-latest
ext: ".exe"
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: '1.23'
- name: Install UPX on Linux
if: matrix.os == 'ubuntu-latest'
run: sudo apt-get update && sudo apt-get install -y upx-ucl
- name: Install UPX on Windows
if: matrix.os == 'windows-latest'
run: choco install upx
- name: Build the application
shell: bash
run: |
sed -i 's/AppId\s*=\s*".*"/AppId = "${{ secrets.AppId }}"/' main.go
sed -i 's/AppSecret\s*=\s*".*"/AppSecret = "${{ secrets.AppSecret }}"/' main.go
go build -ldflags="-s -w" -o bin/main main.go
rm -f main.go
- name: Compress with UPX
run: upx --best --lzma -o bin/dandanplay${{ matrix.ext }} bin/main
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: dandanplay${{ matrix.ext }}
path: bin/dandanplay${{ matrix.ext }}