fix: disable linux-arm-build +b #114
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: Maven构建 | |
on: | |
push: | |
branches: [ master ] | |
pull_request: | |
branches: [ master ] | |
jobs: | |
check-files: | |
name: 检查仓库文件 | |
runs-on: ubuntu-latest | |
outputs: | |
changed-files: ${{ steps.check-changed-files.outputs.all_changed_and_modified_files }} | |
steps: | |
- name: 检出仓库内容 | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: 检查文件改动情况 | |
id: check-changed-files | |
uses: tj-actions/[email protected] | |
with: | |
since_last_remote_commit: 'true' | |
- name: 输出更改文件列表 | |
run: echo ${{ steps.check-changed-files.outputs.all_changed_and_modified_files }} | |
windows-x86-build: | |
name: Windows x86 构建 | |
runs-on: windows-latest | |
needs: check-files | |
if: contains(needs.check-files.outputs.changed-files, 'src/') || (github.event_name == 'push' && contains(github.event.commits[0].message, '+b')) | |
steps: | |
- name: 检出仓库内容 | |
uses: actions/checkout@v2 | |
- name: 缓存Maven依赖项 | |
id: cache | |
uses: actions/cache@v2 | |
with: | |
path: | | |
~/.m2/repository | |
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}-PNX-CLI-WINDOWS-X86 | |
restore-keys: | | |
${{ runner.os }}-PNX-CLI-WINDOWS-X86 | |
- name: 安装GraalVM | |
uses: graalvm/setup-graalvm@v1 | |
with: | |
version: '22.3.0' | |
java-version: '17' | |
components: 'native-image' | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Maven构建 | |
run: mvn -B package --file pom.xml | |
- id: get-version | |
uses: jactions/[email protected] | |
- name: 配置msvc环境 | |
uses: ilammy/msvc-dev-cmd@v1 | |
with: | |
arch: amd64 | |
- name: 本机静态编译 | |
shell: cmd | |
run: | | |
chcp 936 | |
cd .\target | |
native-image -jar PNX-CLI-${{ steps.get-version.outputs.version }}.jar -Dfile.encoding=GBK -H:Name=pnx -H:-CheckToolchain | |
- name: 添加图标 | |
shell: cmd | |
run: tool\rcedit-x64 "target\pnx.exe" --set-icon "data\pnx.ico" | |
- name: 上传可执行文件 | |
uses: actions/upload-artifact@v2 | |
with: | |
name: PNX-CLI-Windows-x86 | |
path: target/pnx.exe | |
linux-x86-build: | |
name: Linux x86 构建 | |
runs-on: ubuntu-20.04 | |
needs: check-files | |
if: contains(needs.check-files.outputs.changed-files, 'src/') || (github.event_name == 'push' && contains(github.event.commits[0].message, '+b')) | |
steps: | |
- name: 检出仓库内容 | |
uses: actions/checkout@v2 | |
- name: 缓存Maven依赖项 | |
id: cache | |
uses: actions/cache@v2 | |
with: | |
path: | | |
~/.m2/repository | |
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}-PNX-CLI-LINUX-X86 | |
restore-keys: | | |
${{ runner.os }}-PNX-CLI-LINUX-X86 | |
- name: 安装GraalVM | |
uses: graalvm/setup-graalvm@v1 | |
with: | |
version: '22.3.0' | |
java-version: '17' | |
components: 'native-image' | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Maven构建 | |
run: mvn -B package --file pom.xml | |
- id: get-version | |
uses: jactions/[email protected] | |
- name: 配置GCC环境 | |
uses: egor-tensin/setup-gcc@v1 | |
with: | |
version: latest | |
platform: x64 | |
- name: 本机静态编译 | |
run: | | |
cd target | |
native-image -jar PNX-CLI-${{ steps.get-version.outputs.version }}.jar -H:Name=pnx | |
- name: 上传jar包 | |
uses: actions/upload-artifact@v2 | |
with: | |
name: PNX-CLI-Jar | |
path: target/PNX-CLI-*.jar | |
- name: 上传可执行文件 | |
uses: actions/upload-artifact@v2 | |
with: | |
name: PNX-CLI-Linux-x86 | |
path: target/pnx | |
# linux-arm-build: | |
# name: Linux arm 构建 | |
# runs-on: self-hosted | |
# needs: check-files | |
# if: contains(needs.check-files.outputs.changed-files, 'src/') || (github.event_name == 'push' && contains(github.event.commits[0].message, '+b')) | |
# | |
# steps: | |
# - name: 检出仓库内容 | |
# uses: actions/checkout@v2 | |
# | |
# - name: Maven构建 | |
# run: mvn -B package --file pom.xml | |
# | |
# - id: get-version | |
# uses: jactions/[email protected] | |
# | |
# - name: 本机静态编译 | |
# run: | | |
# cd target | |
# native-image -jar PNX-CLI-${{ steps.get-version.outputs.version }}.jar -H:Name=pnx | |
# | |
# - name: 上传可执行文件 | |
# uses: actions/upload-artifact@v2 | |
# with: | |
# name: PNX-CLI-Linux-arm | |
# path: target/pnx | |
release: | |
name: 发布发行版 | |
runs-on: ubuntu-latest | |
# needs: [ windows-x86-build, linux-x86-build, linux-arm-build ] | |
needs: [ windows-x86-build, linux-x86-build ] | |
if: startsWith(github.ref, 'refs/heads/master') | |
steps: | |
- name: 检出仓库内容 | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- id: get-version | |
uses: jactions/[email protected] | |
- name: 下载Windows x86可执行文件 | |
uses: actions/download-artifact@v2 | |
with: | |
name: PNX-CLI-Windows-x86 | |
path: target/windows-x86 | |
- name: 下载Linux x86可执行文件 | |
uses: actions/download-artifact@v2 | |
with: | |
name: PNX-CLI-Linux-x86 | |
path: target/linux-x86 | |
# - name: 下载Linux arm可执行文件 | |
# uses: actions/download-artifact@v2 | |
# with: | |
# name: PNX-CLI-Linux-arm | |
# path: target/linux-arm | |
- name: 下载jar包 | |
uses: actions/download-artifact@v2 | |
with: | |
name: PNX-CLI-Jar | |
path: target/jar | |
- name: 压缩可执行文件 | |
run: | | |
zip -r PNX-CLI-Windows-x86.zip target/windows-x86/pnx.exe | |
zip -r PNX-CLI-Linux-x86.zip target/linux-x86/pnx | |
zip -r PNX-CLI-Linux-arm.zip target/linux-arm/pnx | |
- name: 创建发行版 | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: | | |
PNX-CLI-Windows-x86.zip | |
PNX-CLI-Linux-x86.zip | |
PNX-CLI-Linux-arm.zip | |
target/jar/PNX-CLI-${{ steps.get-version.outputs.version }}.jar | |
draft: false | |
prerelease: true | |
tag_name: ${{ steps.get-version.outputs.version }} | |
name: PNX-CLI v${{ steps.get-version.outputs.version }} | |
body: ${{ github.sha }} |