forked from GUI-for-Cores/GUI.for.SingBox
-
Notifications
You must be signed in to change notification settings - Fork 0
130 lines (119 loc) · 3.98 KB
/
release.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
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
name: Build GUI.for.SingBox
on:
push:
tags:
- "v*"
jobs:
Build:
permissions: write-all
strategy:
fail-fast: false
matrix:
build:
- os: windows-latest
GOOS: windows
GOARCH: amd64
- os: windows-latest
GOOS: windows
GOARCH: arm64
- os: windows-latest
GOOS: windows
GOARCH: 386
- os: macos-latest
GOOS: darwin
GOARCH: amd64
- os: macos-latest
GOOS: darwin
GOARCH: arm64
- os: ubuntu-latest
GOOS: linux
GOARCH: amd64
# - os: ubuntu-latest
# GOOS: linux
# GOARCH: arm64
runs-on: ${{ matrix.build.os }}
env:
APP_NAME: GUI.for.SingBox
ZIP_FILE: GUI.for.SingBox-${{ matrix.build.GOOS }}-${{ matrix.build.GOARCH }}.zip
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: ./go.mod
- run: go version
- name: Set up pnpm
uses: pnpm/action-setup@v4
with:
version: 9
- run: pnpm -v
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "latest"
cache: "pnpm"
cache-dependency-path: frontend/pnpm-lock.yaml
- run: node -v
- name: Install dependencies
run: |
cd frontend && pnpm install
go install github.com/wailsapp/wails/v2/cmd/wails@latest
# Dependencies: GNU/Linux
- name: Update system and dependencies
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.1-dev
# Hide dock bar icon: macOS
- name: Update system and dependencies
if: runner.os == 'macOS'
run: |
go mod vendor
sed -i "" "s/\[NSApp setActivationPolicy:NSApplicationActivationPolicyRegular\]/[NSApp setActivationPolicy:NSApplicationActivationPolicyAccessory]/g" vendor/github.com/wailsapp/wails/v2/internal/frontend/desktop/darwin/AppDelegate.m
- name: Build Frontend
run: cd frontend && pnpm build
# Build
- name: Build for ${{ matrix.build.GOOS }}-${{ matrix.build.GOARCH }}
env:
GOOS: ${{ matrix.build.GOOS }}
GOARCH: ${{ matrix.build.GOARCH }}
run: ~/go/bin/wails build -m -s -trimpath -skipbindings -devtools -tags webkit2_41 -o ${{ env.APP_NAME }}.exe
# Compress: macOS
- name: Create a compressed file for macOS
if: runner.os == 'macOS'
run: |
cd ./build/bin
# The compiled product name of macos is always "${{ env.APP_NAME }}.app"
zip -q -r ${{ env.ZIP_FILE }} ${{ env.APP_NAME }}.app
# Compress: Windows
- name: Create a compressed file for Windows
if: runner.os == 'Windows'
run: |
cd ./build/bin
Compress-Archive -Path ${{ env.APP_NAME }}.exe -DestinationPath ${{ env.ZIP_FILE }}
# Compress: GNU/Linux
- name: Create a compressed file for GNU/Linux
if: runner.os == 'Linux'
run: |
cd ./build/bin
mv ${{ env.APP_NAME }}.exe ${{ env.APP_NAME }}
zip ${{ env.ZIP_FILE }} ${{ env.APP_NAME }}
# Artifact
# - name: Upload Artifact ${{ env.ZIP_FILE }}
# uses: actions/upload-artifact@v3
# with:
# name: ${{ env.ZIP_FILE }}
# path: ./build/bin/${{ env.ZIP_FILE }}
- name: Create Release and Upload Assets
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ./build/bin/${{ env.ZIP_FILE }}
asset_name: ${{ env.ZIP_FILE }}
tag: ${{ github.ref }}
release_name: ${{ github.ref_name }}
overwrite: true
draft: false
prerelease: false
body: |
Auto-generated release from GitHub Actions.