-
Notifications
You must be signed in to change notification settings - Fork 0
267 lines (261 loc) · 12.4 KB
/
main.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
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
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
name: Package and deploy versions
on:
push:
branches: ["main"]
jobs:
project-info:
runs-on: ubuntu-latest
container:
image: ubuntu:latest
outputs:
PROJECT_ARTIFACT: ${{ steps.project-info.outputs.PROJECT_ARTIFACT }}
PROJECT_VERSION: ${{ steps.project-info.outputs.PROJECT_VERSION }}
steps:
- name: Checkout Code
uses: actions/checkout@v3
- name: Install tools
run: |
apt-get update
apt-get install -y jq libxml2-utils
- name: Store Project Information
id: project-info
run: |
PROJECT_VERSION=$(xmllint --xpath '/*[local-name()="project"]/*[local-name()="version"]/text()' pom.xml | sed 's/-SNAPSHOT/.${{github.run_number}}'/)
echo "PROJECT_VERSION=${PROJECT_VERSION}"
echo "PROJECT_VERSION=${PROJECT_VERSION}" >> $GITHUB_OUTPUT
PROJECT_ARTIFACT=$(xmllint --xpath '/*[local-name()="project"]/*[local-name()="artifactId"]/text()' pom.xml)
echo "PROJECT_ARTIFACT=${PROJECT_ARTIFACT}"
echo "PROJECT_ARTIFACT=${PROJECT_ARTIFACT}" >> $GITHUB_OUTPUT
linux-build:
needs: project-info
runs-on: ubuntu-latest
container:
image: ubuntu:latest
steps:
- name: Checkout Code
uses: actions/checkout@v3
- name: Install tools
run: |
apt-get update
apt-get install -y jq git libxml2-utils nsis curl zip unzip tar gzip gcc zlib1g-dev
- uses: graalvm/setup-graalvm@v1
with:
java-version: '22'
distribution: 'graalvm'
github-token: ${{ github.token }}
- run: which java && java -version
- name: Set Version
run: |
./mvnw -U --batch-mode versions:set dependency:tree -DnewVersion=${{ needs.project-info.outputs.PROJECT_VERSION }}
- name: Build
run: ./mvnw --batch-mode -Pnative -Dagent=true -Dosname.short=Linux clean install
- name: 'Upload Jar'
uses: actions/upload-artifact@v4
with:
name: ${{ needs.project-info.outputs.PROJECT_ARTIFACT }}-${{ needs.project-info.outputs.PROJECT_VERSION }}.jar
path: ./target/${{ needs.project-info.outputs.PROJECT_ARTIFACT }}-${{ needs.project-info.outputs.PROJECT_VERSION }}.jar
retention-days: 1
if-no-files-found: error
- name: 'Upload Shaded'
uses: actions/upload-artifact@v4
with:
name: ${{ needs.project-info.outputs.PROJECT_ARTIFACT }}-${{ needs.project-info.outputs.PROJECT_VERSION }}-shaded.jar
path: ./target/${{ needs.project-info.outputs.PROJECT_ARTIFACT }}-${{ needs.project-info.outputs.PROJECT_VERSION }}-shaded.jar
retention-days: 1
if-no-files-found: error
- name: 'Upload Zip'
uses: actions/upload-artifact@v4
with:
name: ${{ needs.project-info.outputs.PROJECT_ARTIFACT }}-${{ needs.project-info.outputs.PROJECT_VERSION }}-anyos.zip
path: ./target/${{ needs.project-info.outputs.PROJECT_ARTIFACT }}-${{ needs.project-info.outputs.PROJECT_VERSION }}-anyos.zip
retention-days: 1
if-no-files-found: error
- name: 'Upload TGZ'
uses: actions/upload-artifact@v4
with:
name: ${{ needs.project-info.outputs.PROJECT_ARTIFACT }}-${{ needs.project-info.outputs.PROJECT_VERSION }}-anyos.tar.gz
path: ./target/${{ needs.project-info.outputs.PROJECT_ARTIFACT }}-${{ needs.project-info.outputs.PROJECT_VERSION }}-anyos.tar.gz
retention-days: 1
if-no-files-found: error
- name: 'Upload Windows Installer'
uses: actions/upload-artifact@v4
with:
name: ${{ needs.project-info.outputs.PROJECT_ARTIFACT }}-${{ needs.project-info.outputs.PROJECT_VERSION }}-installer.exe
path: ./target/${{ needs.project-info.outputs.PROJECT_ARTIFACT }}-${{ needs.project-info.outputs.PROJECT_VERSION }}-installer.exe
retention-days: 1
if-no-files-found: error
- name: 'Upload Linux Binary'
uses: actions/upload-artifact@v4
with:
name: ${{ needs.project-info.outputs.PROJECT_ARTIFACT }}-${{ needs.project-info.outputs.PROJECT_VERSION }}-Linux-amd64.bin
path: ./target/${{ needs.project-info.outputs.PROJECT_ARTIFACT }}-${{ needs.project-info.outputs.PROJECT_VERSION }}-Linux-amd64
retention-days: 1
if-no-files-found: error
windows-build:
needs: project-info
runs-on: windows-latest
steps:
- name: Checkout Code
uses: actions/checkout@v3
- uses: ilammy/msvc-dev-cmd@v1
- uses: graalvm/setup-graalvm@v1
with:
java-version: '22'
distribution: 'graalvm'
github-token: ${{ github.token }}
- run: java -version
- name: Set Version
run: |
./mvnw -U --batch-mode versions:set dependency:tree "-DnewVersion=${{ needs.project-info.outputs.PROJECT_VERSION }}"
- name: Build
run: ./mvnw --batch-mode -Pnative -Dagent=true clean package && ls target
- name: 'Upload Windows Binary'
uses: actions/upload-artifact@v4
with:
name: ${{ needs.project-info.outputs.PROJECT_ARTIFACT }}-${{ needs.project-info.outputs.PROJECT_VERSION }}-Windows-amd64.exe
path: ./target/${{ needs.project-info.outputs.PROJECT_ARTIFACT }}-${{ needs.project-info.outputs.PROJECT_VERSION }}-Windows-amd64.exe
retention-days: 1
if-no-files-found: error
mac-build:
needs: project-info
runs-on: macos-latest
steps:
- name: Checkout Code
uses: actions/checkout@v3
- uses: graalvm/setup-graalvm@v1
with:
java-version: '22'
distribution: 'graalvm'
github-token: ${{ github.token }}
- run: java -version
- run: brew install makensis
- name: Set Version
run: |
./mvnw -U --batch-mode versions:set dependency:tree -DnewVersion=${{ needs.project-info.outputs.PROJECT_VERSION }}
- name: Build
run: ./mvnw --batch-mode -Pnative -Dagent=true clean package && ls target
- name: 'Upload Mac Binary'
uses: actions/upload-artifact@v4
with:
name: ${{ needs.project-info.outputs.PROJECT_ARTIFACT }}-${{ needs.project-info.outputs.PROJECT_VERSION }}-Mac-x86_64.bin
path: ./target/${{ needs.project-info.outputs.PROJECT_ARTIFACT }}-${{ needs.project-info.outputs.PROJECT_VERSION }}-Mac-x86_64
retention-days: 1
if-no-files-found: error
release:
runs-on: ubuntu-latest
container:
image: ubuntu:latest
needs: [project-info, linux-build, windows-build, mac-build]
steps:
- name: Checkout Code
uses: actions/checkout@v3
- name: Download All Artifacts
uses: actions/download-artifact@v4
with:
path: target
merge-multiple: true
- name: release
uses: actions/create-release@v1
id: create_release
with:
draft: false
prerelease: false
release_name: ${{ needs.project-info.outputs.PROJECT_VERSION }}
tag_name: ${{ needs.project-info.outputs.PROJECT_VERSION }}
body_path: README.md
env:
GITHUB_TOKEN: ${{ github.token }}
- name: Upload JAR
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./target/${{ needs.project-info.outputs.PROJECT_ARTIFACT }}-${{ needs.project-info.outputs.PROJECT_VERSION }}.jar
asset_name: ${{ needs.project-info.outputs.PROJECT_ARTIFACT }}-${{ needs.project-info.outputs.PROJECT_VERSION }}.jar
asset_content_type: application/java-archive
- name: Upload Shaded JAR
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./target/${{ needs.project-info.outputs.PROJECT_ARTIFACT }}-${{ needs.project-info.outputs.PROJECT_VERSION }}-shaded.jar
asset_name: ${{ needs.project-info.outputs.PROJECT_ARTIFACT }}-${{ needs.project-info.outputs.PROJECT_VERSION }}-shaded.jar
asset_content_type: application/java-archive
- name: Upload Zip
id: upload-zip
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./target/${{ needs.project-info.outputs.PROJECT_ARTIFACT }}-${{ needs.project-info.outputs.PROJECT_VERSION }}-anyos.zip
asset_name: ${{ needs.project-info.outputs.PROJECT_ARTIFACT }}-${{ needs.project-info.outputs.PROJECT_VERSION }}-anyos.zip
asset_content_type: application/zip
- name: Upload TGZ
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./target/${{ needs.project-info.outputs.PROJECT_ARTIFACT }}-${{ needs.project-info.outputs.PROJECT_VERSION }}-anyos.tar.gz
asset_name: ${{ needs.project-info.outputs.PROJECT_ARTIFACT }}-${{ needs.project-info.outputs.PROJECT_VERSION }}-anyos.tar.gz
asset_content_type: application/tar+gzip
- name: Upload EXE
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./target/${{ needs.project-info.outputs.PROJECT_ARTIFACT }}-${{ needs.project-info.outputs.PROJECT_VERSION }}-installer.exe
asset_name: ${{ needs.project-info.outputs.PROJECT_ARTIFACT }}-${{ needs.project-info.outputs.PROJECT_VERSION }}-installer.exe
asset_content_type: application/tar+gzip
- name: Upload Linux Bin
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./target/${{ needs.project-info.outputs.PROJECT_ARTIFACT }}-${{ needs.project-info.outputs.PROJECT_VERSION }}-Linux-amd64
asset_name: ${{ needs.project-info.outputs.PROJECT_ARTIFACT }}-${{ needs.project-info.outputs.PROJECT_VERSION }}-Linux-amd64.bin
asset_content_type: application/octet-stream
- name: Upload Mac Bin
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./target/${{ needs.project-info.outputs.PROJECT_ARTIFACT }}-${{ needs.project-info.outputs.PROJECT_VERSION }}-Mac-x86_64
asset_name: ${{ needs.project-info.outputs.PROJECT_ARTIFACT }}-${{ needs.project-info.outputs.PROJECT_VERSION }}-Mac-x86_64.bin
asset_content_type: application/octet-stream
- name: Upload Bin
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ github.token }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./target/${{ needs.project-info.outputs.PROJECT_ARTIFACT }}-${{ needs.project-info.outputs.PROJECT_VERSION }}-Windows-amd64.exe
asset_name: ${{ needs.project-info.outputs.PROJECT_ARTIFACT }}-${{ needs.project-info.outputs.PROJECT_VERSION }}-Windows-amd64.exe
asset_content_type: application/octet-stream
- uses: graalvm/setup-graalvm@v1
with:
java-version: '22'
distribution: 'graalvm'
github-token: ${{ github.token }}
- run: which java && java -version
- name: Install tools
run: |
apt-get update
apt-get install -y jq git libxml2-utils nsis curl zip unzip tar gzip gcc zlib1g-dev
- name: Set Version
run: |
./mvnw -U --batch-mode versions:set dependency:tree -DnewVersion=${{ needs.project-info.outputs.PROJECT_VERSION }}
- name: Deploy to Github Package Registry
env:
GITHUB_TOKEN: ${{ github.token }}
run: |
mkdir -p ~/.m2
echo "<settings><servers><server><id>gh</id><username>${{github.actor}}</username><password>${{github.token}}</password></server></servers></settings>" > ~/.m2/settings.xml
REPO="gh::default::https://maven.pkg.github.com/${{github.repository}}"
./mvnw deploy -DaltReleaseDeploymentRepository="${REPO}" -DaltSnapshotDeploymentRepository="${REPO}"