-
Notifications
You must be signed in to change notification settings - Fork 8
179 lines (158 loc) · 5.09 KB
/
Copy pathpackage.yml
File metadata and controls
179 lines (158 loc) · 5.09 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
name: package
on:
workflow_dispatch:
inputs:
version:
description: 'Release version (e.g. v0.3.0-beta)'
required: true
title:
description: 'Release title (e.g. 新增免补丁文件创建节点)'
required: true
highlights:
description: 'Release highlights (one per line)'
required: true
type: textarea
prerelease:
description: 'Is prerelease'
required: false
type: boolean
default: false
make_latest:
description: 'Mark as latest release'
required: false
type: boolean
default: true
jobs:
build-jar:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: Set up JDK 25
uses: actions/setup-java@v4
with:
java-version: '25'
distribution: 'temurin'
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Build frontend
run: |
cd frontend
npm install
npm run build
- name: Build backend with Maven
run: mvn clean package -DskipTests
- name: Upload jar artifact
uses: actions/upload-artifact@v4
with:
name: backend-jar
path: backend/target/runify.jar
- name: Create Release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ inputs.version }}
name: ${{ inputs.title }}
body: ${{ inputs.highlights }}
files: backend/target/runify.jar
prerelease: ${{ inputs.prerelease }}
make_latest: ${{ inputs.make_latest }}
build-desktop:
needs: build-jar
strategy:
matrix:
os: [macos-latest, windows-latest]
include:
- os: macos-latest
platform: mac
- os: windows-latest
platform: win
runs-on: ${{ matrix.os }}
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: Download jar artifact
uses: actions/download-artifact@v4
with:
name: backend-jar
path: installer/electron
- name: Download JRE
shell: bash
run: |
cd installer
bash installer.sh --jre-only 2>/dev/null || true
# Download JDK 25 for the platform
JAVA_VERSION="25"
HASH="bd75d5f9689641da8e1daabeccb5528b"
BASE="https://download.java.net/java/GA/jdk${JAVA_VERSION}/${HASH}/36/GPL"
JRE_DIR="electron/jre"
mkdir -p "$JRE_DIR"
if [ "${{ matrix.platform }}" = "mac" ]; then
ARCH=$(uname -m)
if [ "$ARCH" = "arm64" ]; then
URL="${BASE}/openjdk-${JAVA_VERSION}_macos-aarch64_bin.tar.gz"
else
URL="${BASE}/openjdk-${JAVA_VERSION}_macos-x64_bin.tar.gz"
fi
curl -fL --connect-timeout 10 --max-time 600 -o /tmp/jdk.tar.gz "$URL"
tar -xzf /tmp/jdk.tar.gz -C "$JRE_DIR"
# Flatten
NESTED=$(find "$JRE_DIR" -maxdepth 1 -type d -name "jdk-*" | head -1)
if [ -n "$NESTED" ]; then
mv "$NESTED"/* "$JRE_DIR"/
rmdir "$NESTED"
fi
else
URL="${BASE}/openjdk-${JAVA_VERSION}_windows-x64_bin.zip"
curl -fL --connect-timeout 10 --max-time 600 -o /tmp/jdk.zip "$URL"
unzip -q /tmp/jdk.zip -d "$JRE_DIR"
INNER=$(ls -d "$JRE_DIR"/*/ 2>/dev/null | head -1)
if [ -n "$INNER" ]; then
mv "$INNER"/* "$JRE_DIR"/
rmdir "$INNER"
fi
fi
echo "JRE downloaded to $JRE_DIR"
- name: Convert icon to ICO for Windows
if: matrix.platform == 'win'
shell: bash
run: |
pip install Pillow
python -c "
from PIL import Image
img = Image.open('installer/electron/icon.png')
sizes = [(16,16),(32,32),(48,48),(64,64),(128,128),(256,256)]
img.save('installer/electron/icon.ico', format='ICO', sizes=sizes)
"
- name: Install Electron dependencies
run: |
cd installer/electron
npm install
- name: Build Electron app
run: |
cd installer/electron
npm run build:${{ matrix.platform }}
- name: Sign macOS app
if: matrix.platform == 'mac'
run: |
cd installer/electron
find dist -name "*.app" -exec codesign --force --deep --sign - {} \;
- name: Upload desktop installer
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ inputs.version }}
files: |
installer/electron/dist/*.dmg
installer/electron/dist/*.exe
generate_release_notes: false
make_latest: ${{ inputs.make_latest }}
- name: Upload artifacts for TOS
uses: actions/upload-artifact@v4
with:
name: desktop-${{ matrix.platform }}
path: |
installer/electron/dist/*.dmg
installer/electron/dist/*.exe