From 299d75957b7d0c03c82fc3a37ffc8e0e0ae32b9f Mon Sep 17 00:00:00 2001 From: songyinyin Date: Wed, 25 Oct 2023 11:57:57 +0800 Subject: [PATCH] test github action v15 --- .../{jar_release.yml => linux_mac_native.yml} | 11 ++- .github/workflows/windows-native.yml | 83 +++++++++++++++++++ 2 files changed, 88 insertions(+), 6 deletions(-) rename .github/workflows/{jar_release.yml => linux_mac_native.yml} (88%) create mode 100644 .github/workflows/windows-native.yml diff --git a/.github/workflows/jar_release.yml b/.github/workflows/linux_mac_native.yml similarity index 88% rename from .github/workflows/jar_release.yml rename to .github/workflows/linux_mac_native.yml index 58ad39f4..706fbfa1 100644 --- a/.github/workflows/jar_release.yml +++ b/.github/workflows/linux_mac_native.yml @@ -12,8 +12,7 @@ jobs: fail-fast: false matrix: # see: https://docs.github.com/zh/actions/using-jobs/choosing-the-runner-for-a-job - os: ['ubuntu-20.04', 'windows-latest', 'macos-latest'] - # os: ['ubuntu-latest'] + os: ['ubuntu-20.04', 'macos-12'] name: build - ${{ matrix.os }} runs-on: ${{ matrix.os }} # https://github.com/softprops/action-gh-release/issues/236#issuecomment-1150530128 @@ -56,7 +55,7 @@ jobs: with: type: 'zip' path: 'neutrino-proxy-server' - filename: neutrino-proxy-server-${{ matrix.os }}.zip + filename: neutrino-proxy-server-${{ matrix.os }}-${{ github.ref }}.zip - name: Build with Maven (neutrino-proxy-client) run: | cd neutrino-proxy-client @@ -68,7 +67,7 @@ jobs: with: type: 'zip' path: 'neutrino-proxy-client' - filename: neutrino-proxy-client-${{ matrix.os }}.zip + filename: neutrino-proxy-client-${{ matrix.os }}-${{ github.ref }}.zip # GitHub 上创建 release - name: Release uses: softprops/action-gh-release@v1 @@ -77,7 +76,7 @@ jobs: files: | neutrino-proxy-server/target/neutrino-proxy-server.jar neutrino-proxy-client/target/neutrino-proxy-client.jar - neutrino-proxy-server-${{ matrix.os }}.zip - neutrino-proxy-client-${{ matrix.os }}.zip + neutrino-proxy-server-${{ matrix.os }}-${{ github.ref }}.zip + neutrino-proxy-client-${{ matrix.os }}-${{ github.ref }}.zip prerelease: true token: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/windows-native.yml b/.github/workflows/windows-native.yml new file mode 100644 index 00000000..2c09aa7e --- /dev/null +++ b/.github/workflows/windows-native.yml @@ -0,0 +1,83 @@ +name: jar release + +on: + workflow_dispatch: + push: + tags: + - 'v*' + +jobs: + build: + strategy: + fail-fast: false + matrix: + # see: https://docs.github.com/zh/actions/using-jobs/choosing-the-runner-for-a-job +# os: ['ubuntu-20.04', 'windows-latest', 'macos-latest'] + os: ['windows-2022'] + name: build - ${{ matrix.os }} + runs-on: ${{ matrix.os }} + # https://github.com/softprops/action-gh-release/issues/236#issuecomment-1150530128 + permissions: + contents: write + steps: + - uses: actions/checkout@v3 + - name: setup node v13.12.0 + uses: actions/setup-node@v3 + with: + node-version: 13.12.0 + # cache: 'npm' # 使用缓存需要把 package-lock.json 也上传到 git 上 + - name: build neutrino-proxy-admin + run: | + cd neutrino-proxy-admin + npm install + npm run build:dev + xcopy /s /i ./dist/ ./../neutrino-proxy-server/src/main/resources/static/ + - name: GitHub Action for GraalVM JDK 17 + uses: graalvm/setup-graalvm@v1 + with: + java-version: '17.0.7' # for a specific JDK 17; or '17' for the latest JDK 17 + distribution: 'graalvm' # New 'distribution' option + github-token: ${{ secrets.GITHUB_TOKEN }} + - 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 (neutrino-proxy-server) + run: | + mvn clean install -pl neutrino-proxy-core -am -DskipTests --no-transfer-progress + cd neutrino-proxy-server + mvn clean native:compile -P native --file pom.xml --no-transfer-progress + xcopy target/neutrino-proxy-server ./../ + - name: Archive zip (neutrino-proxy-server) + uses: thedoctor0/zip-release@master + with: + type: 'zip' + path: 'neutrino-proxy-server' + filename: neutrino-proxy-server-${{ matrix.os }}-${{ github.ref }}.zip + - name: Build with Maven (neutrino-proxy-client) + run: | + cd neutrino-proxy-client + mvn clean package --file pom.xml --no-transfer-progress + mvn clean native:compile -P native --file pom.xml --no-transfer-progress + xcopy target/neutrino-proxy-client ./../ + - name: Archive zip (neutrino-proxy-client) + uses: thedoctor0/zip-release@master + with: + type: 'zip' + path: 'neutrino-proxy-client' + filename: neutrino-proxy-client-${{ matrix.os }}-${{ github.ref }}.zip + # GitHub 上创建 release + - name: Release + uses: softprops/action-gh-release@v1 + if: startsWith(github.ref, 'refs/tags/') + with: + files: | + neutrino-proxy-server/target/neutrino-proxy-server.jar + neutrino-proxy-client/target/neutrino-proxy-client.jar + neutrino-proxy-server-${{ matrix.os }}-${{ github.ref }}.zip + neutrino-proxy-client-${{ matrix.os }}-${{ github.ref }}.zip + prerelease: true + token: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file