Skip to content
Merged
75 changes: 69 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ on:
- '**'

jobs:
build:
name: Migtool build
build-linux:
name: Migtool build for linux-x86
if: "!contains(github.event.head_commit.message, '[ci skip]')"
runs-on: ubuntu-latest
timeout-minutes: 90
Expand All @@ -23,7 +23,7 @@ jobs:
run: env | sort

- name: Checkout
uses: actions/checkout@v1
uses: actions/checkout@v4
with:
fetch-depth: 1

Expand Down Expand Up @@ -52,7 +52,7 @@ jobs:
- name: Upload linux native image artifact
uses: actions/upload-artifact@v4
with:
name: migtool-linux
name: migtool-linux-x86
path: build/native/nativeCompile/migtool
overwrite: true

Expand All @@ -69,10 +69,73 @@ jobs:
path: build/reports/tests/nativeCliTest/
overwrite: true

build-macos:
name: Migtool build for MacOS-arm64
if: "!contains(github.event.head_commit.message, '[ci skip]')"
runs-on: macos-latest
timeout-minutes: 90
strategy:
fail-fast: false

steps:
- name: Environment
run: env | sort

- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 1

- name: Setup Graalvm
uses: graalvm/setup-graalvm@v1
with:
java-version: '21'
distribution: 'graalvm'
github-token: ${{ secrets.GITHUB_TOKEN }}
native-image-job-reports: 'true'

- name: Build Native Image
run: ./gradlew nativeCompile

- name: Codesign binary
if: contains(github.event.head_commit.message, '[release]') && github.event.ref == 'refs/heads/master'
env:
MACOS_CERTIFICATE: ${{ secrets.MACOS_CERTIFICATE }}
MACOS_CERTIFICATE_PWD: ${{ secrets.MACOS_CERTIFICATE_PWD }}
MACOS_CERTIFICATE_NAME: ${{ secrets.MACOS_CERTIFICATE_NAME }}
MACOS_CI_KEYCHAIN_PWD: ${{ secrets.MACOS_CI_KEYCHAIN_PWD }}
run: |
echo $MACOS_CERTIFICATE | base64 --decode > certificate.p12
security create-keychain -p "$MACOS_CI_KEYCHAIN_PWD" build.keychain
security default-keychain -s build.keychain
security unlock-keychain -p "$MACOS_CI_KEYCHAIN_PWD" build.keychain
security import certificate.p12 -k build.keychain -P "$MACOS_CERTIFICATE_PWD" -T /usr/bin/codesign
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k "$MACOS_CI_KEYCHAIN_PWD" build.keychain
/usr/bin/codesign --force -s "$MACOS_CERTIFICATE_NAME" --options runtime build/native/nativeCompile/migtool -v

- name: Notarize binary
if: contains(github.event.head_commit.message, '[release]') && github.event.ref == 'refs/heads/master'
env:
MACOS_AC_API_CERT: ${{ secrets.MACOS_AC_API_CERT }}
MACOS_AC_API_ISSUER_ID: ${{ secrets.MACOS_AC_API_ISSUER_ID }}
MACOS_AC_API_KEY_ID: ${{ secrets.MACOS_AC_API_KEY_ID }}
run: |
echo $MACOS_AC_API_CERT | base64 --decode > AuthKey.p8
xcrun notarytool store-credentials "notarytool-profile" -k AuthKey.p8 -d "$MACOS_AC_API_KEY_ID" -i "$MACOS_AC_API_ISSUER_ID"
ditto -c -k --keepParent "build/native/nativeCompile/migtool" "notarization.zip"
xcrun notarytool submit "notarization.zip" --keychain-profile "notarytool-profile" --wait

- name: Upload MacOS native image artifact
uses: actions/upload-artifact@v4
with:
name: migtool-macos-arm64
path: build/native/nativeCompile/migtool
overwrite: true

release:
name: Release
if: "contains(github.event.head_commit.message, '[release]') && github.event.ref=='refs/heads/master'"
needs: [ build ]
needs: [ build-linux, build-macos ]
runs-on: ubuntu-latest
steps:
- name: Checkout repository
Expand All @@ -94,7 +157,7 @@ jobs:
run: |
VERSION=$(cat ./VERSION)
echo "VERSION = $VERSION"
echo "::set-output name=VERSION::$VERSION"
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT

- name: Run JReleaser
uses: jreleaser/release-action@v2
Expand Down
5 changes: 4 additions & 1 deletion jreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ distributions:
migtool:
type: NATIVE_IMAGE
artifacts:
- path: "migtool-linux/migtool"
- path: "migtool-linux-x86/migtool"
transform: "{{distributionName}}-linux-x86_64"
platform: linux-x86_64
- path: "migtool-macos-arm64/migtool"
transform: "{{distributionName}}-macos-arm64"
platform: osx-aarch_64