From 46d1485da5341a3f9f7b79ac1b95700168c05026 Mon Sep 17 00:00:00 2001 From: Anders Nickelsen Date: Thu, 19 Sep 2024 12:08:56 +0200 Subject: [PATCH] feat: Cross-compile and release for intel and arm architectures (#73) --- .github/workflows/publish.yaml | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index f1c093a..4c5550a 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -10,7 +10,10 @@ permissions: jobs: build: - runs-on: ubuntu-latest + strategy: + matrix: + machine: [ubuntu-latest, self-hosted-arm64] + runs-on: ${{ matrix.machine }} steps: - uses: actions/checkout@v4 - name: Set up JDK @@ -25,21 +28,24 @@ jobs: key: ${{ runner.os }}-${{ hashFiles('**/build.gradle.kts') }} - name: Install dependencies run: | - sudo apt update - sudo apt install libcurl4-openssl-dev + sudo apt -y update + sudo apt -y install libcurl4-openssl-dev - name: Build with Gradle run: ./gradlew commonBinaries - name: Move and apply correct permissions to binary run: | - cp build/bin/common/releaseExecutable/slack-notifier-cli.kexe ./slack-notifier-cli - chmod +x ./slack-notifier-cli + cp build/bin/common/releaseExecutable/slack-notifier-cli.kexe ./slack-notifier-cli-${{ runner.arch }} + chmod +x ./slack-notifier-cli-${{ runner.arch }} - name: Upload executable uses: actions/upload-artifact@v4 with: - name: slack-notifier-cli - path: slack-notifier-cli - change-log: - runs-on: ubuntu-latest + name: slack-notifier-cli-${{ runner.arch }} + path: slack-notifier-cli-${{ runner.arch }} + publish: + strategy: + matrix: + machine: [ubuntu-latest, self-hosted-arm64] + runs-on: ${{ matrix.machine }} needs: build timeout-minutes: 5 steps: @@ -58,15 +64,15 @@ jobs: output: "console" slack-token: ${{ secrets.SLACK_APP_TOKEN }} slack-channel: "#releases" - - name: Download a single artifact + - name: Download executable uses: actions/download-artifact@v4 with: - name: slack-notifier-cli - - name: Upload binaries to release + name: slack-notifier-cli-${{ runner.arch }} + - name: Publish executable as release asset uses: svenstaro/upload-release-action@v2 with: repo_token: ${{ secrets.GITHUB_TOKEN }} - file: slack-notifier-cli - asset_name: slack-notifier-cli + file: slack-notifier-cli-${{ runner.arch }} + asset_name: slack-notifier-cli-${{ runner.arch }} tag: ${{ github.ref }} overwrite: true