更新 maven-publish.yml

This commit is contained in:
Yang Yang
2024-02-23 00:09:20 +08:00
committed by GitHub
parent 3c4bb13c57
commit 771e771025

View File

@@ -1,46 +1,44 @@
name: Java CI with Maven and GraalVM Native Image
namname: Build and Upload Spring Boot Native Image with Maven
on:
workflow_dispatch:
push:
branches:
- main
pull_request:
jobs:
build:
runs-on: windows-latest
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
- name: Set up GraalVM
- name: Set up JDK 17
uses: actions/setup-java@v2
with:
java-version: '17'
distribution: 'temurin'
- name: Cache Maven packages
uses: actions/cache@v2
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- name: Install GraalVM
uses: DeLaGuardo/setup-graalvm@5.0
with:
graalvm-version: '21.0.2'
java-version: 'java17'
graalvm-version: '21.3.0' # Ensure this version is compatible with Java 17
java-version: '17'
# 打包应用程序
- name: Package Application
run: |
./mvnw native:compile -Pnative
- name: Build native image with Maven
run: ./mvnw native:compile -Pnative
# 创建并发布 Release
- name: Create and Publish a Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Move binary to target folder
run: mv ./gpt-4-copilot-0.0.4 ./target/gpt-4-copilot-0.0.4 Replace your-binary-name with the actual name of your binary file
- name: Upload native image from target folder
uses: actions/upload-artifact@v2
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false
# 上传构建文件到 Release
- name: Upload Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./gpt-copilot-java
asset_name: gpt-copilot-java.exe
asset_content_type: application/octet-stream
name: native-image
path: target/gpt-4-copilot-0.0.4