-
Notifications
You must be signed in to change notification settings - Fork 0
71 lines (69 loc) · 2.39 KB
/
native_image_release_linux_mac.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
name: Build linux and mac native image
on:
workflow_dispatch:
push:
tags:
- 'v*'
jobs:
build:
strategy:
fail-fast: false
matrix:
# 'ubuntu-latest', 'windows-latest', 'macos-latest'
# os: ['ubuntu-20.04', 'macos-12']
os: ['ubuntu-20.04']
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: 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: Set vars
run: |
OS=$(echo '${{ runner.os }}' | awk '{print tolower($0)}')
[[ $OS == 'ubuntu' ]] && echo "OS=linux" >> $GITHUB_ENV || echo "OS=$OS" >> $GITHUB_ENV
[[ $OS == 'macos' ]] && echo "OS=darwin" >> $GITHUB_ENV || echo "OS=$OS" >> $GITHUB_ENV
echo "VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV
- name: Build with Maven
run: |
mvn clean install -DskipTests -pl common -am --no-transfer-progress
cd app-runner
mvn clean native:compile -P native --no-transfer-progress
cp target/app ./../app
# 压缩文件
- name: Archive zip
uses: thedoctor0/zip-release@master
with:
type: 'zip'
path: 'app'
filename: app-${{ env.OS }}
# 上传构建产物
- name: Upload artifact
uses: actions/[email protected]
with:
name: app-${{ env.OS }}.zip
path: app-${{ env.OS }}.zip
# GitHub 上创建 release
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
app-${{ env.OS }}.zip
app-runner/target/app.jar
prerelease: true
token: ${{ secrets.GITHUB_TOKEN }}