Skip to content

Commit 92ec072

Browse files
committed
feat: separate builds for linux and macos, sign and notarize macos
binaries on release [release]
1 parent 94012ba commit 92ec072

File tree

1 file changed

+73
-15
lines changed

1 file changed

+73
-15
lines changed

.github/workflows/build.yml

Lines changed: 73 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,20 @@ on:
1010
- '**'
1111

1212
jobs:
13-
build:
14-
name: Migtool build for ${{matrix.os}}
13+
build-linux:
14+
name: Migtool build for linux-x86
1515
if: "!contains(github.event.head_commit.message, '[ci skip]')"
16-
runs-on: ${{matrix.os}}
16+
runs-on: ubuntu-latest
1717
timeout-minutes: 90
1818
strategy:
1919
fail-fast: false
20-
matrix:
21-
os: [ubuntu-latest, macos-latest]
2220

2321
steps:
2422
- name: Environment
2523
run: env | sort
2624

2725
- name: Checkout
28-
uses: actions/checkout@v1
26+
uses: actions/checkout@v4
2927
with:
3028
fetch-depth: 1
3129

@@ -37,31 +35,28 @@ jobs:
3735
github-token: ${{ secrets.GITHUB_TOKEN }}
3836
native-image-job-reports: 'true'
3937

40-
4138
- name: Tests
42-
if: ${{ !(runner.os == 'macOS' && runner.arch == 'ARM64') }}
4339
run: ./gradlew check
4440

4541
- name: Tests reports
4642
uses: actions/upload-artifact@v4
4743
if: failure()
4844
with:
49-
name: ${{matrix.os}}-test-reports
45+
name: linux-test-reports
5046
path: build/reports/tests/test/
5147
overwrite: true
5248

5349
- name: Build Native Image
5450
run: ./gradlew nativeCompile
5551

56-
- name: Upload ${{matrix.os}} native image artifact
52+
- name: Upload linux native image artifact
5753
uses: actions/upload-artifact@v4
5854
with:
59-
name: migtool-${{matrix.os}}
55+
name: migtool-linux-x86
6056
path: build/native/nativeCompile/migtool
6157
overwrite: true
6258

6359
- name: Tests native
64-
if: ${{ !(runner.os == 'macOS' && runner.arch == 'ARM64') }}
6560
run: ./gradlew cleanTest check
6661
env:
6762
NATIVE_BINARY_PATH: build/native/nativeCompile/migtool
@@ -70,14 +65,77 @@ jobs:
7065
uses: actions/upload-artifact@v4
7166
if: failure()
7267
with:
73-
name: ${{matrix.os}}-testsNative-reports
68+
name: linux-testsNative-reports
7469
path: build/reports/tests/nativeCliTest/
7570
overwrite: true
7671

72+
build-macos:
73+
name: Migtool build for MacOS-arm64
74+
if: "!contains(github.event.head_commit.message, '[ci skip]')"
75+
runs-on: macos-latest
76+
timeout-minutes: 90
77+
strategy:
78+
fail-fast: false
79+
80+
steps:
81+
- name: Environment
82+
run: env | sort
83+
84+
- name: Checkout
85+
uses: actions/checkout@v4
86+
with:
87+
fetch-depth: 1
88+
89+
- name: Setup Graalvm
90+
uses: graalvm/setup-graalvm@v1
91+
with:
92+
java-version: '21'
93+
distribution: 'graalvm'
94+
github-token: ${{ secrets.GITHUB_TOKEN }}
95+
native-image-job-reports: 'true'
96+
97+
- name: Build Native Image
98+
run: ./gradlew nativeCompile
99+
100+
- name: Codesign binary
101+
if: contains(github.event.head_commit.message, '[release]') && github.event.ref == 'refs/heads/master'
102+
env:
103+
MACOS_CERTIFICATE: ${{ secrets.MACOS_CERTIFICATE }}
104+
MACOS_CERTIFICATE_PWD: ${{ secrets.MACOS_CERTIFICATE_PWD }}
105+
MACOS_CERTIFICATE_NAME: ${{ secrets.MACOS_CERTIFICATE_NAME }}
106+
MACOS_CI_KEYCHAIN_PWD: ${{ secrets.MACOS_CI_KEYCHAIN_PWD }}
107+
run: |
108+
echo $MACOS_CERTIFICATE | base64 --decode > certificate.p12
109+
security create-keychain -p "$MACOS_CI_KEYCHAIN_PWD" build.keychain
110+
security default-keychain -s build.keychain
111+
security unlock-keychain -p "$MACOS_CI_KEYCHAIN_PWD" build.keychain
112+
security import certificate.p12 -k build.keychain -P "$MACOS_CERTIFICATE_PWD" -T /usr/bin/codesign
113+
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k "$MACOS_CI_KEYCHAIN_PWD" build.keychain
114+
/usr/bin/codesign --force -s "$MACOS_CERTIFICATE_NAME" --options runtime build/native/nativeCompile/migtool -v
115+
116+
- name: Notarize binary
117+
if: contains(github.event.head_commit.message, '[release]') && github.event.ref == 'refs/heads/master'
118+
env:
119+
MACOS_AC_API_CERT: ${{ secrets.MACOS_AC_API_CERT }}
120+
MACOS_AC_API_ISSUER_ID: ${{ secrets.MACOS_AC_API_ISSUER_ID }}
121+
MACOS_AC_API_KEY_ID: ${{ secrets.MACOS_AC_API_KEY_ID }}
122+
run: |
123+
echo $MACOS_AC_API_CERT | base64 --decode > AuthKey.p8
124+
xcrun notarytool store-credentials "notarytool-profile" -k AuthKey.p8 -d "$MACOS_AC_API_KEY_ID" -i "$MACOS_AC_API_ISSUER_ID"
125+
ditto -c -k --keepParent "build/native/nativeCompile/migtool" "notarization.zip"
126+
xcrun notarytool submit "notarization.zip" --keychain-profile "notarytool-profile" --wait
127+
128+
- name: Upload MacOS native image artifact
129+
uses: actions/upload-artifact@v4
130+
with:
131+
name: migtool-macos-arm64
132+
path: build/native/nativeCompile/migtool
133+
overwrite: true
134+
77135
release:
78136
name: Release
79137
if: "contains(github.event.head_commit.message, '[release]') && github.event.ref=='refs/heads/master'"
80-
needs: [ build ]
138+
needs: [ build-linux, build-macos ]
81139
runs-on: ubuntu-latest
82140
steps:
83141
- name: Checkout repository
@@ -99,7 +157,7 @@ jobs:
99157
run: |
100158
VERSION=$(cat ./VERSION)
101159
echo "VERSION = $VERSION"
102-
echo "::set-output name=VERSION::$VERSION"
160+
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
103161
104162
- name: Run JReleaser
105163
uses: jreleaser/release-action@v2

0 commit comments

Comments
 (0)