Skip to content

Instantly share code, notes, and snippets.

@aalmiray
Created July 13, 2021 21:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aalmiray/0e8c10df180aa29060952025938faa9a to your computer and use it in GitHub Desktop.
Save aalmiray/0e8c10df180aa29060952025938faa9a to your computer and use it in GitHub Desktop.
kcctl
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.2.0</version>
<configuration>
<attach>false</attach>
<appendAssemblyId>false</appendAssemblyId>
<finalName>kcctl-${project.version}-${os.detected.classifier}</finalName>
<workDirectory>${project.build.directory}/assembly/work</workDirectory>
<skipAssembly>true</skipAssembly>
</configuration>
<executions>
<execution>
<id>make-distribution</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
<?xml version="1.0"?>
<assembly
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
<id>dist</id>
<formats>
<format>zip</format>
<format>dir</format>
</formats>
<files>
<file>
<source>LICENSE.txt</source>
<outputDirectory>./</outputDirectory>
</file>
<file>
<source>kcctl_completion</source>
<outputDirectory>./</outputDirectory>
</file>
<file>
<source>${project.build.directory}/${project.artifactId}-${project.version}-runner.exe</source>
<outputDirectory>./bin</outputDirectory>
<destName>kcctl.exe</destName>
</file>
</files>
</assembly>
<?xml version="1.0"?>
<assembly
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
<id>dist</id>
<formats>
<format>zip</format>
<format>dir</format>
</formats>
<files>
<file>
<source>LICENSE.txt</source>
<outputDirectory>./</outputDirectory>
</file>
<file>
<source>kcctl_completion</source>
<outputDirectory>./</outputDirectory>
</file>
<file>
<source>${project.build.directory}/${project.artifactId}-${project.version}-runner</source>
<outputDirectory>./bin</outputDirectory>
<destName>kcctl</destName>
</file>
</files>
</assembly>
name: EarlyAccess
on:
push:
branches: [ main ]
jobs:
# Build native executable per runner
build:
name: 'Build with Graal on ${{ matrix.os }}'
if: github.repository == 'gunnarmorling/kcctl' && startsWith(github.event.head_commit.message, 'Releasing version') != true
strategy:
fail-fast: true
matrix:
os: [ ubuntu-latest, macOS-latest, windows-latest ]
gu-binary: [ gu, gu.cmd ]
exclude:
- os: ubuntu-latest
gu-binary: gu.cmd
- os: macos-latest
gu-binary: gu.cmd
- os: windows-latest
gu-binary: gu
runs-on: ${{ matrix.os }}
steps:
- name: 'Check out repository'
uses: actions/checkout@v2
- name: 'Add Developer Command Prompt for Microsoft Visual C++ '
if: ${{ runner.os == 'Windows' }}
uses: ilammy/msvc-dev-cmd@v1
- name: 'Set up Graal'
uses: DeLaGuardo/setup-graalvm@4.0
with:
graalvm: '21.1.0'
java: 'java11'
- name: 'Install native-image component'
run: |
${{ matrix.gu-binary }} install native-image
- name: 'Cache Maven packages'
uses: actions/cache@v1
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- name: 'Build Native Image'
run: mvn -B --file pom.xml -Pnative package
- name: 'Create distribution'
run: mvn -B --file pom.xml -Pdist package -DskipTests
- name: 'Upload build artifact'
uses: actions/upload-artifact@v2
with:
name: artifacts
path: target/*.zip
# Collect all executables and release
release:
needs: [ build ]
runs-on: ubuntu-latest
steps:
- name: 'Check out repository'
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: 'Download all build artifacts'
uses: actions/download-artifact@v2
- name: 'Set up Java'
uses: actions/setup-java@v2
with:
java-version: 11
distribution: 'zulu'
- name: 'Version'
id: version
run: |
POM_VERSION=`grep -oE -m 1 "<version>(.*)</version>" pom.xml | awk 'match($0, />.*?</) { print substr($0, RSTART+1, RLENGTH-2); }'`
KCCTL_VERSION=`echo $POM_VERSION | awk 'match($0, /^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)/) { print substr($0, RSTART, RLENGTH); }'`
echo "POM_VERSION = $POM_VERSION"
echo "KCCTL_VERSION = $KCCTL_VERSION"
echo "::set-output name=POM_VERSION::$POM_VERSION"
echo "::set-output name=KCCTL_VERSION::$KCCTL_VERSION"
- name: 'Release with JReleaser'
uses: jreleaser/release-action@v1
with:
version: early-access
env:
JRELEASER_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
JRELEASER_PROJECT_VERSION: ${{ steps.version.outputs.POM_VERSION }}
KCCTL_VERSION: ${{ steps.version.outputs.KCCTL_VERSION }}
project:
name: kcctl
description: kcctl -- A CLI for Apache Kafka Connect
longDescription: kcctl -- A CLI for Apache Kafka Connect
website: https://github.com/gunnarmorling/kcctl
authors:
- Gunnar Morling
license: Apache-2.0
snapshot:
label: '{{ Env.KCCTL_VERSION }}-early-access'
extraProperties:
inceptionYear: 2021
distributions:
kcctl:
type: NATIVE_IMAGE
artifacts:
- path: 'artifacts/{{distributionName}}-{{projectVersion}}-linux-x86_64.zip'
transform: 'artifacts/{{distributionName}}-{{projectEffectiveVersion}}-linux-x86_64.zip'
platform: linux-x86_64
- path: 'artifacts/{{distributionName}}-{{projectVersion}}-windows-x86_64.zip'
transform: 'artifacts/{{distributionName}}-{{projectEffectiveVersion}}-windows-x86_64.zip'
platform: windows-x86_64
- path: 'artifacts/{{distributionName}}-{{projectVersion}}-osx-x86_64.zip'
transform: 'artifacts/{{distributionName}}-{{projectEffectiveVersion}}-osx-x86_64.zip'
platform: osx-x86_64
<build>
<!-- detect OS classifier, needed for distribution Zip file -->
<extensions>
<extension>
<groupId>kr.motd.maven</groupId>
<artifactId>os-maven-plugin</artifactId>
<version>1.7.0</version>
</extension>
</extensions>
</build>
<profiles>
<profile>
<id>dist</id>
<activation>
<property>
<name>dist</name>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<configuration combine.self="append">
<skipAssembly>false</skipAssembly>
<descriptors>
<descriptor>src/main/assembly/assembly.xml</descriptor>
</descriptors>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>dist-windows</id>
<activation>
<os>
<family>windows</family>
</os>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<configuration combine.self="append">
<skipAssembly>false</skipAssembly>
<descriptors>
<descriptor>src/main/assembly/assembly-windows.xml</descriptor>
</descriptors>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment