Release v2.0.4 #39
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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: | |
| os: [ubuntu-latest, windows-latest] | |
| include: | |
| - os: ubuntu-latest | |
| platform: linux | |
| executable_suffix: "" | |
| artifact_name: airopscat-linux-amd64 | |
| - 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 }} | |
| native-image-job-reports: 'true' | |
| - 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 -Dquarkus.native.compression.level=10 | |
| 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: Rename executable (Unix) | |
| if: matrix.os != 'windows-latest' | |
| run: | | |
| mv target/airopscat-*-runner target/${{ matrix.artifact_name }} | |
| - name: Upload executable | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ matrix.artifact_name }} | |
| path: target/${{ matrix.artifact_name }} | |
| retention-days: 30 | |
| - name: Create distribution directory | |
| run: mkdir -p dist | |
| - name: Copy executable to dist (Windows) | |
| if: matrix.os == 'windows-latest' | |
| run: copy target\${{ matrix.artifact_name }} dist\ | |
| shell: cmd | |
| - name: Copy executable to dist (Unix) | |
| if: matrix.os != 'windows-latest' | |
| run: cp target/${{ matrix.artifact_name }} dist/ | |
| - name: Create README for distribution (Linux) | |
| if: matrix.os == 'ubuntu-latest' | |
| run: | | |
| echo "# AirOpsCat Native Executable" > dist/README.txt | |
| echo "" >> dist/README.txt | |
| echo "Platform: ${{ matrix.platform }}" >> dist/README.txt | |
| echo "Built on: $(date)" >> dist/README.txt | |
| echo "Version: ${{ github.ref_name }}" >> dist/README.txt | |
| echo "Framework: Quarkus 3.24.3" >> dist/README.txt | |
| echo "Compression: UPX LZMA (~70% size reduction)" >> dist/README.txt | |
| echo "" >> dist/README.txt | |
| echo "## Usage" >> dist/README.txt | |
| echo "./${{ matrix.artifact_name }}" >> dist/README.txt | |
| echo "" >> dist/README.txt | |
| echo "The application will start on http://localhost:8080" >> dist/README.txt | |
| echo "" >> dist/README.txt | |
| echo "## External Configuration" >> dist/README.txt | |
| echo "Use external application.properties file:" >> dist/README.txt | |
| echo "./${{ matrix.artifact_name }} -Dquarkus.config.locations=./application.properties" >> dist/README.txt | |
| - name: Create README for distribution (Windows) | |
| if: matrix.os == 'windows-latest' | |
| run: | | |
| echo "# AirOpsCat Native Executable" > dist/README.txt | |
| echo "" >> dist/README.txt | |
| echo "Platform: ${{ matrix.platform }}" >> dist/README.txt | |
| echo "Built on: %date%" >> dist/README.txt | |
| echo "Version: ${{ github.ref_name }}" >> dist/README.txt | |
| echo "Framework: Quarkus 3.24.3" >> dist/README.txt | |
| echo "Compression: None (UPX disabled for Windows compatibility)" >> dist/README.txt | |
| echo "" >> dist/README.txt | |
| echo "## Usage" >> dist/README.txt | |
| echo "${{ matrix.artifact_name }}" >> dist/README.txt | |
| echo "" >> dist/README.txt | |
| echo "The application will start on http://localhost:8080" >> dist/README.txt | |
| echo "" >> dist/README.txt | |
| echo "## External Configuration" >> dist/README.txt | |
| echo "Use external application.properties file:" >> dist/README.txt | |
| echo "${{ matrix.artifact_name }} -Dquarkus.config.locations=./application.properties" >> dist/README.txt | |
| shell: cmd | |
| - name: Create distribution archive (Windows) | |
| if: matrix.os == 'windows-latest' | |
| run: | | |
| 7z a -tzip ${{ matrix.artifact_name }}.zip dist\* | |
| shell: cmd | |
| - name: Create distribution archive (Unix) | |
| if: matrix.os != 'windows-latest' | |
| run: | | |
| cd dist && tar -czf ../${{ matrix.artifact_name }}.tar.gz * | |
| - name: Upload distribution archive | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ matrix.artifact_name }}-distribution | |
| path: | | |
| ${{ matrix.artifact_name }}.zip | |
| ${{ matrix.artifact_name }}.tar.gz | |
| 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 | |
| - **Smart compression**: Linux version uses UPX LZMA (~70% smaller), Windows version uncompressed for compatibility | |
| - **Zero dependencies**: No Java runtime required | |
| - **Production ready**: Optimized native compilation | |
| ### 📦 Download Instructions: | |
| - **Linux**: Download `airopscat-linux-amd64.tar.gz` (~33MB, UPX compressed) | |
| - **Windows**: Download `airopscat-windows-amd64.exe.zip` (~90MB, uncompressed for compatibility) | |
| ### 🛠 Usage: | |
| 1. Extract the archive (if applicable) | |
| 2. Run the executable directly | |
| 3. Open http://localhost:8080 in your browser | |
| ### ⚙️ Advanced Configuration: | |
| Use external configuration file: | |
| ```bash | |
| ./airopscat-linux-amd64 -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 }} |