-
Notifications
You must be signed in to change notification settings - Fork 23
145 lines (121 loc) · 4.34 KB
/
early-access.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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
# Inspired by & copied from JReleaser sample:
# https://github.com/jreleaser/jreleaser/blob/main/.github/workflows/trigger-early-access.yml
name: Publish Early Access builds
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
# Build native executable per runner
build:
if: contains(github.event.head_commit.message, 'Releasing version') != true && contains(github.event.head_commit.message, 'Prepare next version') != true
name: build-${{ matrix.os }}
strategy:
fail-fast: true
matrix:
os: [ ubuntu-latest, macOS-latest, macOS-arm64-latest, windows-latest ]
gu-binary: [ gu, gu.cmd ]
exclude:
- os: ubuntu-latest
gu-binary: gu.cmd
- os: macos-latest
gu-binary: gu.cmd
- os: macos-arm64-latest
gu-binary: gu.cmd
- os: windows-latest
gu-binary: gu
runs-on: ${{ matrix.os }}
steps:
- name: Download all build artifacts
uses: actions/download-artifact@v3
- name: Check out repository
uses: actions/checkout@v3
with:
ref: ${{ steps.head.outputs.content }}
# This action supports Windows; it does nothing on Linux and macOS.
- name: Add Developer Command Prompt for Microsoft Visual C++
uses: ilammy/[email protected]
- name: Setup GraalVM
uses: graalvm/setup-graalvm@v1
with:
distribution: 'graalvm'
java-version: 17
components: 'native-image'
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Get musl toolchain and compile libz against it
id: prepare-musl
run: |
TMP_DIR=$(mktemp -d)
pushd $TMP_DIR
curl -LOJ http://more.musl.cc/10/x86_64-linux-musl/x86_64-linux-musl-native.tgz
tar -xvf x86_64-linux-musl-native.tgz
curl -LOJ https://zlib.net/zlib-1.2.13.tar.gz
tar -xzf zlib-1.2.13.tar.gz
cd zlib-1.2.13
TOOLCHAIN_DIR=$TMP_DIR/x86_64-linux-musl-native
CC=$TOOLCHAIN_DIR/bin/gcc
./configure --prefix=$TOOLCHAIN_DIR --static
make
make install
echo "TOOLCHAIN_DIR=$TOOLCHAIN_DIR" >> $GITHUB_OUTPUT
if: matrix.os == 'ubuntu-latest'
- name: Cache Maven packages
uses: actions/cache@v3
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- name: Build static native image for Linux
run: |
PATH=${TOOLCHAIN_DIR}/bin:$PATH; mvn -B -Pnative package
env:
TOOLCHAIN_DIR: ${{ steps.prepare-musl.outputs.TOOLCHAIN_DIR }}
if: matrix.os == 'ubuntu-latest'
- name: Build static native image for Windows / macOS
run: |
mvn -B -Pnative package
if: matrix.os != 'ubuntu-latest'
- name: Create distribution
run: mvn -B -Pdist package -DskipTests
- name: Upload build artifacts
uses: actions/upload-artifact@v3
with:
name: artifacts
path: |
target/distributions/*.zip
target/distributions/*.tar.gz
# Collect all executables and release
release:
needs: [ build ]
runs-on: ubuntu-latest
permissions: write-all
if: github.event_name != 'pull_request'
steps:
- name: Check out repository
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Check out correct Git ref
run: git checkout ${{ steps.head.outputs.content }}
- name: Download all build artifacts
uses: actions/download-artifact@v3
- name: Cache Maven packages
uses: actions/cache@v3
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- name: Release with JReleaser
run: mvn -B -Prelease -DartifactsDir=artifacts jreleaser:full-release
env:
JRELEASER_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Capture JReleaser output
if: always()
uses: actions/upload-artifact@v3
with:
name: jreleaser-release-output
retention-days: 7
path: |
target/jreleaser/trace.log
target/jreleaser/output.properties