-
Notifications
You must be signed in to change notification settings - Fork 0
193 lines (164 loc) · 5.76 KB
/
Copy pathrelease.yml
File metadata and controls
193 lines (164 loc) · 5.76 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
180
181
182
183
184
185
186
187
188
189
190
191
192
193
name: Build Native Executables
on:
# ! 为了避免重复发布版本,应当通过独特 git tag 触发。
# ! 不再使用 workflow_dispatch 触发。
workflow_dispatch:
push:
# 只通过 v*.*.* 的 tag 触发发布,避免在 main 分支 push 时触发。
tags:
- "v*.*.*"
permissions: write-all
jobs:
build:
name: Build on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-latest
platform: linux
executable_suffix: ""
# - os: windows-latest
# platform: windows
# executable_suffix: ".exe"
# artifact_name: airopscat-windows-amd64.exe
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Setup GraalVM
uses: graalvm/setup-graalvm@v1
with:
java-version: '21'
distribution: 'graalvm-community'
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Cache Maven dependencies
uses: actions/cache@v4
with:
path: |
~/.m2
~/.m2/wrapper
key: ${{ runner.os }}-quarkus-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-quarkus-
${{ runner.os }}-m2-
- name: Verify GraalVM installation
run: |
echo "GRAALVM_HOME: $GRAALVM_HOME"
echo "JAVA_HOME: $JAVA_HOME"
java --version
native-image --version
# - name: Install UPX (Linux)
# if: matrix.os == 'ubuntu-latest'
# run: |
# wget https://github.com/upx/upx/releases/download/v5.0.2/upx-5.0.2-amd64_linux.tar.xz
# tar -xf upx-5.0.2-amd64_linux.tar.xz
# sudo mv upx-5.0.2-amd64_linux/upx /usr/local/bin/
# upx --version
# - name: Install UPX (Windows)
# if: matrix.os == 'windows-latest'
# run: |
# Invoke-WebRequest -Uri "https://github.com/upx/upx/releases/download/v5.0.2/upx-5.0.2-win64.zip" -OutFile "upx.zip"
# Expand-Archive upx.zip -DestinationPath .
# Move-Item upx-5.0.2-win64\upx.exe C:\Windows\System32\
# upx --version
# shell: powershell
# - name: Run tests
# run: ./mvnw test
# - name: Build native executable (Windows)
# if: matrix.os == 'windows-latest'
# run: ./mvnw clean package -Pnative -DskipTests -Dquarkus.native.additional-build-args=-J-Xmx8g
# shell: cmd
# timeout-minutes: 40
- name: Build native executable (Linux)
if: matrix.os == 'ubuntu-latest'
run: ./mvnw -B -ntp package -Pnative -DskipTests -Dquarkus.native.additional-build-args=-J-Xmx8g
timeout-minutes: 40
# - name: Rename executable (Windows)
# if: matrix.os == 'windows-latest'
# run: |
# move target\airopscat-*-runner.exe target\${{ matrix.artifact_name }}
# shell: cmd
- name: Create both Linux versions (regular and UPX)
if: matrix.os == 'ubuntu-latest'
run: |
# Create regular version
cp target/airopscat-*-runner target/airopscat-linux-amd64
# # Create UPX compressed version
# cp target/airopscat-*-runner target/airopscat-linux-amd64-upx
# upx --best target/airopscat-linux-amd64-upx
- name: Create distribution directories (Linux)
if: matrix.os == 'ubuntu-latest'
run: mkdir -p dist-regular dist-upx
# - name: Create distribution directories (Windows)
# if: matrix.os == 'windows-latest'
# run: mkdir dist
# shell: cmd
#
# - name: Copy executable to dist (Windows)
# if: matrix.os == 'windows-latest'
# run: copy target\${{ matrix.artifact_name }} dist\
# shell: cmd
- name: Copy executables to dist (Linux)
if: matrix.os == 'ubuntu-latest'
run: |
cp target/airopscat-linux-amd64 dist-regular/
# cp target/airopscat-linux-amd64-upx dist-upx/
# - name: Create distribution archive (Windows)
# if: matrix.os == 'windows-latest'
# run: |
# 7z a -tzip ${{ matrix.artifact_name }}.zip dist\*
# shell: cmd
- name: Create distribution archives (Linux)
if: matrix.os == 'ubuntu-latest'
run: |
tar -czf airopscat-linux-amd64.tar.gz -C dist-regular airopscat-linux-amd64
# tar -czf airopscat-linux-amd64-upx.tar.gz -C dist-upx airopscat-linux-amd64-upx
- name: Upload Linux regular distribution
if: matrix.os == 'ubuntu-latest'
uses: actions/upload-artifact@v4
with:
name: airopscat-linux-amd64-distribution
path: airopscat-linux-amd64.tar.gz
retention-days: 30
# - name: Upload Linux UPX distribution
# if: matrix.os == 'ubuntu-latest'
# uses: actions/upload-artifact@v4
# with:
# name: airopscat-linux-amd64-upx-distribution
# path: airopscat-linux-amd64-upx.tar.gz
# retention-days: 30
# - name: Upload distribution archive (Windows)
# if: matrix.os == 'windows-latest'
# uses: actions/upload-artifact@v4
# with:
# name: ${{ matrix.artifact_name }}-distribution
# path: ${{ matrix.artifact_name }}.zip
# retention-days: 30
release:
name: Create Release
runs-on: ubuntu-latest
needs: build
if: startsWith(github.ref, 'refs/tags/v')
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
- name: Create Release
uses: softprops/action-gh-release@v1
with:
files: |
**/airopscat-*
body: |
## AirOpsCat ${{ github.ref_name }}
Native Linux build for this version.
Artifact:
- `airopscat-linux-amd64.tar.gz`
Usage:
- Extract the archive
- Run `./airopscat-linux-amd64`
- Open `http://localhost:8080`
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}