Skip to content

Commit

Permalink
Introduce jreleaser build and release workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
Rounak Datta committed Aug 7, 2023
1 parent 99b7f2b commit a18d9e7
Show file tree
Hide file tree
Showing 3 changed files with 114 additions and 1 deletion.
62 changes: 62 additions & 0 deletions .github/workflows/publish_cli_artifacts.yml
Original file line number Diff line number Diff line change
@@ -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 }}
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
51 changes: 51 additions & 0 deletions jreleaser.yml
Original file line number Diff line number Diff line change
@@ -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"

0 comments on commit a18d9e7

Please sign in to comment.