-
Notifications
You must be signed in to change notification settings - Fork 23
163 lines (135 loc) · 4.99 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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
# 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-12, macOS-arm64-latest, windows-latest ]
gu-binary: [ gu, gu.cmd ]
exclude:
- os: ubuntu-latest
gu-binary: gu.cmd
- os: macOS-12
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/[email protected]
- name: Check out repository
uses: actions/[email protected]
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/[email protected]
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/fossils/zlib-1.3.tar.gz
tar -xzf zlib-1.3.tar.gz
cd zlib-1.3
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
id: restore-maven-package-cache
uses: actions/cache/[email protected]
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/[email protected]
with:
name: artifacts-${{ matrix.os }}
path: |
target/distributions/*.zip
target/distributions/*.tar.gz
- name: Save downloaded Maven packages
uses: actions/cache/[email protected]
with:
path: ~/.m2
key: ${{ steps.restore-maven-package-cache.outputs.cache-primary-key }}
if: github.event_name != 'pull_request'
# 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/[email protected]
with:
fetch-depth: 0
- name: Check out correct Git ref
run: git checkout ${{ steps.head.outputs.content }}
- name: Download all build artifacts
uses: actions/[email protected]
with:
path: /tmp/artifacts
- name: Move build artifacts to correct folder
run: |
targets=("ubuntu-latest" "macOS-latest" "macOS-arm64-latest" "windows-latest")
mkdir -p artifacts
find /tmp/artifacts/ -name "mcs*" -exec mv -v {} artifacts/ \;
- name: Cache Maven packages
uses: actions/[email protected]
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.GH_PAT }}
- name: Capture JReleaser output
if: always()
uses: actions/[email protected]
with:
name: jreleaser-release-output
retention-days: 7
path: |
target/jreleaser/trace.log
target/jreleaser/output.properties