-
Notifications
You must be signed in to change notification settings - Fork 4
107 lines (93 loc) · 3.02 KB
/
package.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
name: Package
on:
#push:
workflow_dispatch:
inputs:
version:
type: string
description: The version to publish
required: true
publish_github:
description: 'Create draft GitHub release'
default: true
type: boolean
jobs:
package:
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Set up Java
uses: actions/setup-java@v4
with:
java-version: 18.0.2
distribution: 'zulu'
java-package: 'jdk+fx'
cache: 'maven'
- name: Build native installer
run: mvn clean install
- name: Upload native installer
uses: actions/upload-artifact@v4
with:
name: J3-${{ runner.os }}
path: |
./target/*.msi
./target/*.dmg
./target/*.deb
- name: Create platform-independent bundle
if: runner.os == 'Linux'
run: |
pushd target
mkdir bundle
mkdir bundle/J3
cp -r lib/ bundle/J3
cp -r runtime/ bundle/J3
cp -r ../data bundle/J3
cp -r ../animations bundle/J3
cp ../COPYING bundle/J3
cp ../README.md bundle/J3
cp ../src/packaging/j3.bat bundle/J3
cp ../src/packaging/j3 bundle/J3
chmod +x bundle/J3/j3
- name: Upload platform-independent bundle
if: runner.os == 'Linux'
uses: actions/upload-artifact@v4
with:
name: J3
path: |
./target/bundle
publish:
if: inputs.publish_github
runs-on: ubuntu-latest
needs: package
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
path: temp
- name: Install required software
run: |
sudo apt install xmlstarlet
- name: Get project settings
run: |
shortname=$(xmlstarlet sel -N x="http://maven.apache.org/POM/4.0.0" -t -v "//x:project/x:artifactId/text()" pom.xml)
version=$(xmlstarlet sel -N x="http://maven.apache.org/POM/4.0.0" -t -v "//x:project/x:version/text()" pom.xml)
echo "BUILD_NAME=${shortname}" >> $GITHUB_ENV
echo "BUILD_VERSION=${version}" >> $GITHUB_ENV
- name: Validate version number
run: |
[ "${{ inputs.version }}" == "${BUILD_VERSION}" ] || (>&2 echo "Version does not match value in pom.xml"; exit -1)
- name: Stage content
run: |
mkdir release
cp temp/J3-Windows/* release
cp temp/J3-Linux/* release
cp temp/J3-macOS/* release
zip -r release/J3.zip temp/J3
- name: Stage GitHub release
run: |
gh release create "v${{ inputs.version }}" --draft --title "Version ${{ inputs.version }}" release/*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}