Skip to content

Release v2.1.4:数据备份功能 #82

Release v2.1.4:数据备份功能

Release v2.1.4:数据备份功能 #82

Workflow file for this run

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
- 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
target/quarkus-app/lib/
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: Prepare for native build
run: ./mvnw clean compile -DskipTests
- 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 clean 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 executables for Linux and Windows built with Quarkus 3.24.3.
### 🚀 Key Features:
- **Ultra-fast startup**: < 0.2 seconds
- **Multiple Linux variants**: Regular and UPX-compressed versions
- **Zero dependencies**: No Java runtime required
- **Production ready**: Optimized native compilation
### 📦 Download Instructions:
- **Linux (Regular)**: Download `airopscat-linux-amd64.tar.gz` (~90MB, uncompressed)
- **Linux (UPX)**: Download `airopscat-linux-amd64-upx.tar.gz` (~30MB, UPX --best compressed)
- **Windows**: Download `airopscat-windows-amd64.exe.zip` (~90MB, uncompressed for compatibility)
### 🛠 Usage:
1. Extract the tar.gz archive (Linux) or zip file (Windows)
2. Run the executable directly
3. Open http://localhost:8080 in your browser
### ⚙️ Advanced Configuration:
Use external configuration file:
```bash
# Linux
./airopscat-linux-amd64 -Dquarkus.config.locations=./application.properties
# or UPX version
./airopscat-linux-amd64-upx -Dquarkus.config.locations=./application.properties
```
### 📋 System Requirements:
- **Linux**: x86_64 architecture, glibc 2.17+
- **Windows**: x86_64 architecture, Windows 10+
- **Memory**: 512MB RAM minimum
- **Storage**: 50MB free space
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}