jpackage windows release #9
This file contains 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: jpackage windows release | |
on: | |
workflow_dispatch: | |
push: | |
tags: | |
- 'v*' | |
jobs: | |
build: | |
strategy: | |
fail-fast: false | |
matrix: | |
# 暂时跳过 windows-latest | |
os: [ windows-latest] | |
name: build - ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '17' | |
distribution: 'oracle' | |
# server-id: github # Value of the distributionManagement/repository/id field of the pom.xml | |
# settings-path: ${{ github.workspace }} # location for the settings.xml file | |
# - name: GitHub Action for GraalVM JDK 17 | |
# uses: graalvm/[email protected] | |
# with: | |
# java-version: '17' | |
# distribution: 'graalvm' | |
- name: Cache local Maven repository | |
uses: actions/cache@v2 | |
with: | |
path: ~/.m2/repository | |
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | |
restore-keys: | | |
${{ runner.os }}-maven- | |
- name: Build with Maven | |
run: mvn clean install | |
- name: Jpackage | |
run: jpackage --type exe --input . --name binfast-apijson --main-jar target/binfast-apijson-0.0.2-SNAPSHOT.jar --dest ./target --win-menu --win-shortcut --icon ./target/classes/marshall.ico | |
# 压缩文件 | |
- name: Archive zip | |
uses: thedoctor0/zip-release@master | |
with: | |
type: 'zip' | |
path: 'target/binfast-apijson-1.0*' | |
filename: binfast-apijson-${{ matrix.os }}.zip | |
exclusions: 'target/binfast-apijson-*.txt' | |
# 上传构建产物 | |
- name: Upload artifact | |
uses: actions/[email protected] | |
with: | |
name: binfast-apijson-${{ matrix.os }}.zip | |
path: binfast-apijson-${{ matrix.os }}.zip | |
# GitHub 上创建 release | |
- name: Release | |
uses: softprops/action-gh-release@v1 | |
if: startsWith(github.ref, 'refs/tags/') | |
with: | |
files: binfast-apijson-${{ matrix.os }}.zip | |
prerelease: true | |
token: ${{ secrets.GH_TOKEN }} |