diff --git a/.github/workflows/publish_cli_artifacts.yml b/.github/workflows/publish_cli_artifacts.yml new file mode 100644 index 0000000..e88054b --- /dev/null +++ b/.github/workflows/publish_cli_artifacts.yml @@ -0,0 +1,62 @@ +name: Publish CLI Artifacts +on: + workflow_dispatch: + +jobs: + build_and_assemble: + strategy: + matrix: + os: [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: Build Binary + run: ./gradlew runDebugExecutableNative + + - 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.GH_PAT }} diff --git a/build.gradle.kts b/build.gradle.kts index 69f5b72..969c465 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -12,7 +12,7 @@ kotlin { val hostOs = System.getProperty("os.name") val isMingwX64 = hostOs.startsWith("Windows") val nativeTarget = when { - hostOs == "Mac OS X" -> macosX64("native") + hostOs == "Mac OS X" -> macosArm64("native") isMingwX64 -> mingwX64("native") hostOs == "Linux" -> linuxX64("native") else -> throw GradleException("Host OS is not supported: $hostOs") diff --git a/jreleaser.yml b/jreleaser.yml new file mode 100644 index 0000000..deb643e --- /dev/null +++ b/jreleaser.yml @@ -0,0 +1,51 @@ +project: + name: cmdk + description: cmdk is the command line client to interact with the CommandK platform + links: + homepage: https://github.com/commandk-dev/cli + java: + groupId: dev.commandk + version: 17 + inceptionYear: 2023 + stereotype: cli + +release: + github: + branch: main + overwrite: true + sign: false + changelog: + formatted: 'ALWAYS' + format: '- {{commitShortHash}} {{commitTitle}}' + preset: 'conventional-commits' + contributors: + format: '- {{contributorName}}{{#contributorUsernameAsLink}} ({{.}}){{/contributorUsernameAsLink}}' + +signing: + active: never + armored: true + +assemble: + archive: + cmdk-cli-client: + active: ALWAYS + attachPlatform: true + fileSets: + - input: 'build/bin/native/releaseExecutable' + output: 'bin' + includes: [ 'cli.kexe' ] + mapper: + type: 'identity' + includes: + - pattern: 'cli.kexe' + to: 'cmdk-${platform}' + +environment: + properties: + artifactsDir: out/jreleaser/cmdk/archive + +distributions: + cmdk: + artifacts: + - path: "{{artifactsDir}}/cmdk-{{platform}}" + platform: "linux-x86_64"