Skip to content

更新版本号

更新版本号 #6

Workflow file for this run

name: Build & Package
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
workflow_dispatch:
jobs:
build:
name: Build on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
platform: linux
jpackage_type: deb
- os: windows-latest
platform: windows
jpackage_type: exe
- os: macos-latest
platform: macos
jpackage_type: dmg
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up JDK 25
uses: actions/setup-java@v4
with:
java-version: '25'
distribution: 'temurin'
cache: maven
- name: Build fat JAR with Maven
run: mvn --batch-mode clean package
- name: Install WiX Toolset (Windows only)
if: matrix.os == 'windows-latest'
run: |
choco install wixtoolset --no-progress -y
echo "C:\Program Files (x86)\WiX Toolset v3.11\bin" >> $env:GITHUB_PATH
shell: pwsh
- name: Create native image with jpackage
shell: bash
run: |
JAR_FILE=$(ls target/*-jar-with-dependencies.jar | head -1)
WIN_SHORTCUT=""
if [[ "${{ matrix.os }}" == "windows-latest" ]]; then
WIN_SHORTCUT="--win-shortcut --win-dir-chooser"
fi
APP_VERSION="$(mvn -q -DforceStdout help:evaluate -Dexpression=project.version)"
echo "APP_VERSION=$APP_VERSION"
jpackage \
--input target \
--main-jar "$(basename "$JAR_FILE")" \
--main-class xyz.zcraft.Main \
--name "OneCourseElect" \
--app-version "$APP_VERSION" \
--vendor "Zayrex" \
--description "同济大学1系统抢课助手" \
--dest target/dist \
${WIN_SHORTCUT} \
--type ${{ matrix.jpackage_type }} \
--java-options "--enable-native-access=ALL-UNNAMED --sun-misc-unsafe-memory-access=allow"
- name: Upload native installer artifact
uses: actions/upload-artifact@v4
with:
name: 1CourseElect-${{ matrix.platform }}
path: target/dist/*
retention-days: 30
- name: Upload fat JAR artifact
if: matrix.os == 'ubuntu-latest'
uses: actions/upload-artifact@v4
with:
name: 1CourseElect-jar-with-dependencies
path: target/*-jar-with-dependencies.jar
retention-days: 30