Skip to content

Publish CLI Artifacts #5

Publish CLI Artifacts

Publish CLI Artifacts #5

name: Publish CLI Artifacts
on:
workflow_dispatch:
jobs:
build_and_assemble:
strategy:
matrix:
os: [macos-13, ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout the source code
uses: actions/checkout@v3
- name: Setup JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'adopt'
- name: Install prerequisites for Linux runner
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get install libcurl4-openssl-dev
- name: Build Binary
run: ./gradlew linkDebugExecutableNative
- name: Rename the Linux binary appropriately
if: matrix.os == 'ubuntu-latest'
working-directory: ./build/bin/native/debugExecutable
run: |
mv cli.kexe cmdk-linux-x86_64
- name: Rename the macOS binary appropriately
if: matrix.os == 'macos-13'
working-directory: ./build/bin/native/debugExecutable
run: |
mv cli.kexe cmdk-osx-x86_64
- name: Assemble (rename etc) the binaries
uses: jreleaser/release-action@v2
with:
arguments: assemble
env:
JRELEASER_PROJECT_VERSION: ${{ needs.precheck.outputs.VERSION }}
JRELEASER_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
JRELEASER_PLATFORM_OVERRIDE: ${{ matrix.job.jreleaser_platform }}
- name: Stage (i.e. upload, but not yet release) artifacts
uses: actions/upload-artifact@v3
with:
retention-days: 1
name: artifacts
path: |
out/jreleaser/cmdk/archive/*.zip
release:
needs: [ build_and_assemble ]
runs-on: ubuntu-latest
steps:
- name: Checkout the source code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Download the staged artifacts
uses: actions/download-artifact@v3
# the default directory where the artifacts get downloaded is `artifacts`
- name: Release with grandeur
uses: jreleaser/release-action@v2
with:
arguments: full-release -PartifactsDir=artifacts -PskipArchiveResolver
env:
JRELEASER_PROJECT_VERSION: ${{ needs.precheck.outputs.VERSION }}
JRELEASER_GITHUB_TOKEN: ${{ secrets.CMDK_ARTIFACT_PUBLISH_KEY }}