Skip to content

Commit 9ceb298

Browse files
authored
Create build.yml
1 parent 9379b6c commit 9ceb298

File tree

1 file changed

+75
-0
lines changed

1 file changed

+75
-0
lines changed

.github/workflows/build.yml

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
name: Build & Release JAR and EXE
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*.*.*' # runs only on tags starting with v
7+
8+
jobs:
9+
build_and_release:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Check out code
14+
uses: actions/checkout@v3
15+
16+
- name: Set up JDK 17
17+
uses: actions/setup-java@v3
18+
with:
19+
distribution: temurin
20+
java-version: '17'
21+
22+
- name: Grant Gradle permissions
23+
run: chmod +x gradlew
24+
25+
- name: Build fat JAR
26+
run: ./gradlew clean buildFatJar
27+
# Or if you are using Shadow plugin:
28+
# run: ./gradlew clean shadowJar
29+
30+
# Example jpackage step:
31+
- name: Build Windows .exe with jpackage
32+
# jpackage is available by default in the Java 17 distribution on Ubuntu,
33+
# but note you need to specify --type exe on Windows. On Ubuntu, you can cross-compile
34+
# for Windows using the --win-* flags only if you have the right cross-toolchain set up.
35+
# Typically, you'd run this step on Windows if you want an actual .exe.
36+
# For demonstration, here's how you'd do it on a Windows runner:
37+
if: runner.os == 'Windows'
38+
run: |
39+
jpackage ^
40+
--type exe ^
41+
--name "WorldLinkD" ^
42+
--input .\build\libs ^
43+
--main-jar "worldlinkd.jar" ^
44+
--main-class "aquadx.ApplicationKt" ^
45+
--java-options "-Xmx512m" ^
46+
--win-console
47+
48+
- name: Create Release
49+
id: create_release
50+
uses: actions/create-release@v1
51+
with:
52+
tag_name: ${{ github.ref_name }}
53+
release_name: "Release ${{ github.ref_name }}"
54+
body: "Automated release"
55+
draft: false
56+
prerelease: false
57+
env:
58+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
59+
60+
- name: Upload JAR to Release
61+
uses: actions/upload-release-asset@v1
62+
with:
63+
upload_url: ${{ steps.create_release.outputs.upload_url }}
64+
asset_path: build/libs/worldlinkd.jar
65+
asset_name: worldlinkd.jar
66+
asset_content_type: application/java-archive
67+
68+
- name: Upload EXE to Release
69+
if: runner.os == 'Windows'
70+
uses: actions/upload-release-asset@v1
71+
with:
72+
upload_url: ${{ steps.create_release.outputs.upload_url }}
73+
asset_path: "WorldLinkD-1.0.exe" # adjust if different output file
74+
asset_name: "WorldLinkD-installer.exe" # or any naming convention you want
75+
asset_content_type: application/octet-stream

0 commit comments

Comments
 (0)