-
Notifications
You must be signed in to change notification settings - Fork 26
133 lines (120 loc) · 4.25 KB
/
Prerelease.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
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
name: Build Prerelease
on:
push:
paths-ignore:
- "README.md"
- "version.txt"
- "script/**"
- "docs/**"
- ".idea/**"
- "frontend/.idea/**"
- ".gitignore"
branches:
- main
pull_request_target:
branches:
- main
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
runs-on: ${{ matrix.build.os }}
env:
APP_NAME: pandora-box-${{ matrix.build.GOARCH }}
ZIP_FILE: ${{ 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 Node.js
uses: actions/setup-node@v4
with:
node-version: 20
- run: node -v
- name: get latest geo ip for windows
if: runner.os == 'Windows'
run: |
choco install wget --no-progress
wget -O backend/meta/geoip.metadb https://github.com/MetaCubeX/meta-rules-dat/releases/download/latest/geoip.metadb
wget -O backend/meta/GeoSite.dat https://github.com/MetaCubeX/meta-rules-dat/releases/download/latest/geosite.dat
- name: get latest geo ip for others
if: runner.os != 'Windows'
run: |
wget -O backend/meta/geoip.metadb https://github.com/MetaCubeX/meta-rules-dat/releases/download/latest/geoip.metadb
wget -O backend/meta/GeoSite.dat https://github.com/MetaCubeX/meta-rules-dat/releases/download/latest/geosite.dat
- name: Install dependencies
run: |
cd frontend && npm 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 build-essential pkg-config
- name: Build Frontend
run: cd frontend && npm run 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 -tags with_gvisor,webkit2_41 -skipbindings -m -s -trimpath -nosyncgomod -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"
mv Pandora-Box.app pandora-box-${{ matrix.build.GOARCH }}.app
zip -q -r ${{ env.ZIP_FILE }} pandora-box-${{ matrix.build.GOARCH }}.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 }}
- name: Create Prerelease and Upload
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ./build/bin/${{ env.ZIP_FILE }}
asset_name: ${{ env.ZIP_FILE }}
tag: Prerelease-${{ github.ref_name }}
release_name: Prerelease-${{ github.ref_name }}
overwrite: true
draft: false
prerelease: true
body: |
Synchronize ${{ github.ref_name }} branch code updates, Auto-generated Prerelease from GitHub Actions.