From 6f00c199f277bdec1a8e18c8f3469b0135fce702 Mon Sep 17 00:00:00 2001 From: Yang Yang <153794571+YuWanTingbb@users.noreply.github.com> Date: Fri, 23 Feb 2024 01:22:59 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=20maven-publish.yml?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/maven-publish.yml | 67 +++++++++++++---------------- 1 file changed, 30 insertions(+), 37 deletions(-) diff --git a/.github/workflows/maven-publish.yml b/.github/workflows/maven-publish.yml index a50fff6..e773bf3 100644 --- a/.github/workflows/maven-publish.yml +++ b/.github/workflows/maven-publish.yml @@ -5,49 +5,42 @@ on: branches: - main pull_request: + jobs: build: - name: SpringBootApp 在 ${{ matrix.os }} - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [macos-latest, windows-latest, ubuntu-latest] + runs-on: macos-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v2 - - uses: graalvm/setup-graalvm@v1 - with: - java-version: '21' - distribution: 'graalvm' - github-token: ${{ secrets.GITHUB_TOKEN }} - native-image-job-reports: 'true' + - name: Set up JDK 17 + uses: actions/setup-java@v2 + with: + java-version: '17' + distribution: 'temurin' - - name: 配置 Maven - uses: actions/setup-java@v2 - with: - distribution: 'temurin' - java-version: '17' + - name: Cache Maven packages + uses: actions/cache@v2 + with: + path: ~/.m2 + key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} + restore-keys: ${{ runner.os }}-m2 - - name: Set execute permissions for mvnw - run: chmod +x ./mvnw + - uses: graalvm/setup-graalvm@v1 + with: + java-version: '21' + distribution: 'graalvm' + github-token: ${{ secrets.GITHUB_TOKEN }} + native-image-job-reports: 'true' - - name: Build native image with Maven - run: ./mvnw native:compile -Pnative + - name: Set execute permissions for mvnw + run: chmod +x ./mvnw - - name: 将原生可执行文件重命名并移动到 target 目录 - run: | - mv target/*-runner target/${{ runner.os }}-application # 根据您的 Spring Boot Maven 输出目录和可执行文件名称调整此行。 - if: ${{ matrix.os != 'windows-latest' }} - - - name: 将原生可执行文件重命名并移动到 target 目录 (Windows) - run: | - mv target\*-runner.exe target\application.exe - if: ${{ matrix.os == 'windows-latest' }} + - name: Build native image with Maven + run: ./mvnw native:compile -Pnative + + - name: Upload native image from target folder + uses: actions/upload-artifact@v2 + with: + name: native-image + path: target/gpt-4-copilot-0.4.0 # Replace your-binary-name with the actual name of your binary file - - name: 上传二进制文件 - uses: actions/upload-artifact@v2 - with: - name: springbootapp-${{ matrix.os }} - path: | - target/${{ runner.os }}-application - target/application.exe