-
Notifications
You must be signed in to change notification settings - Fork 0
55 lines (45 loc) · 1.55 KB
/
javafx-gradle-build.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
name: JavaFX Build and Test with Gradle
on:
push:
branches:
- main
- develop
pull_request:
branches:
- main
- develop
jobs:
build:
runs-on: ubuntu-latest # 使用最新的 Ubuntu 环境
steps:
- name: Checkout code
uses: actions/checkout@v4 # 检出代码
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: "graalvm"
- name: Cache Gradle dependencies
uses: actions/cache@v4
with:
path: ~/.gradle/caches # 缓存 Gradle 的依赖
key: ${{ runner.os }}-gradle-${{ hashFiles('**/build.gradle*') }} # 缓存 key
restore-keys: |
${{ runner.os }}-gradle-
- name: Build with Gradle
run: ./gradlew build --no-daemon # 构建项目
- name: Run jlink
run: ./gradlew jlink --no-daemon # 运行测试
- name: Package JavaFX Application
run: ./gradlew jpackageImage # 使用 JavaFX 插件构建可运行的 JAR 文件(如果使用了 jfx-gradle-plugin)
- name: Shadow JavaFX Application
run: ./gradlew shadowJar # 使用 JavaFX 插件构建可运行的 JAR 文件(如果使用了 jfx-gradle-plugin)
# - name: Upload JAR artifact
# uses: actions/upload-artifact@v3
# with:
# name: javafx-artifact
# path: build/libs/*.jar # 上传生成的 JAR 文件
#
# - name: Deploy or release (optional)
# run: |
# echo "Deploying or releasing the application..."