Skip to content

Releases

Releases #38

Workflow file for this run

#
# SPDX-License-Identifier: Apache-2.0
# Copyright (c) The original authors
#
# Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
#
name: Releases
on:
workflow_dispatch:
inputs:
version:
description: "Release version"
required: true
next:
description: "Next version"
required: false
env:
JAVA_VERSION: '21'
JAVA_DISTRO: 'zulu'
GRAAL_VERSION: '21.0.1'
GRAAL_DISTRIBUTION: 'graalvm-community'
jobs:
set-release-version:
runs-on: ubuntu-latest
outputs:
HEAD: ${{ steps.version.outputs.HEAD }}
RELEASE_VERSION: ${{ steps.version.outputs.RELEASE_VERSION }}
NEXT_VERSION: ${{ steps.version.outputs.NEXT_VERSION }}
steps:
- name: 'Checkout GitHub repository'
uses: actions/checkout@v4
with:
clean: true
- name: 'Set up Java'
uses: actions/setup-java@v3
with:
java-version: ${{ env.JAVA_VERSION }}
distribution: ${{ env.JAVA_DISTRO }}
check-latest: true
cache: maven
- name: 'Import GPG key'
uses: crazy-max/ghaction-import-gpg@v6
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.GPG_PASSPHRASE }}
- name: 'Configure Git'
run: |
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"
- name: 'Set release version'
id: version
run: |
RELEASE_VERSION=${{ github.event.inputs.version }}
NEXT_VERSION=${{ github.event.inputs.next }}
if [ -z $NEXT_VERSION ]
then
PLAIN_VERSION=`echo ${RELEASE_VERSION} | awk 'match($0, /^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)/) { print substr($0, RSTART, RLENGTH); }'`
NEXT_VERSION="${PLAIN_VERSION}-SNAPSHOT"
fi
chmod +x ./mvnw
./mvnw -ntp -B versions:set versions:commit -DnewVersion=$RELEASE_VERSION
find . -name 'pom.xml' | xargs git add
git commit -m "ci: release version $RELEASE_VERSION 🎉"
git push --atomic origin HEAD:${GITHUB_REF#refs/heads/}
HEAD=$(git rev-parse HEAD)
echo "HEAD=$HEAD" >> $GITHUB_OUTPUT
echo "RELEASE_VERSION=$RELEASE_VERSION" >> $GITHUB_OUTPUT
echo "NEXT_VERSION=$NEXT_VERSION" >> $GITHUB_OUTPUT
build-distribution:
needs: [ set-release-version ]
name: 'Build with GraalVM on ${{ matrix.os }}'
strategy:
fail-fast: true
matrix:
os: [ ubuntu-latest, macOS-latest, windows-latest ]
runs-on: ${{ matrix.os }}
steps:
- name: 'Checkout GitHub repository'
uses: actions/checkout@v4
with:
ref: ${{ needs.set-release-version.outputs.HEAD }}
fetch-depth: 0
clean: true
- name: 'Add Developer Command Prompt for Microsoft Visual C++'
if: ${{ runner.os == 'Windows' }}
uses: ilammy/msvc-dev-cmd@v1
- name: 'Set up GraalVM'
uses: graalvm/setup-graalvm@v1
with:
java-version: ${{ env.JAVA_VERSION }}
distribution: ${{ env.GRAAL_DISTRIBUTION }}
github-token: ${{ secrets.GITHUB_TOKEN }}
native-image-job-reports: 'true'
- name: 'Build Native Image (Linux)'
if: ${{ runner.os == 'Linux' }}
run: |
./mvnw -ntp -B --file pom.xml -Pnative package
- name: 'Build Native Image (macOS)'
if: ${{ runner.os == 'macOS' }}
run: |
./mvnw -ntp -B --file pom.xml -Pnative package "-DskipTests"
- name: 'Build Native Image (Windows)'
if: ${{ runner.os == 'Windows' }}
run: |
./mvnw -ntp -B --file pom.xml -Pnative package "-DskipTests"
- name: 'Build Java Binary Distribution'
run: |
./mvnw -ntp -B --file pom.xml -Pdist package -DskipTests
- name: 'Build Debian Package (Linux)'
if: ${{ runner.os == 'Linux' }}
run: |
./mvnw -ntp -B --file pom.xml -Pdeb package -DskipTests
- name: 'Upload build artifact'
uses: actions/upload-artifact@v4
with:
name: artifacts-${{ runner.os }}-${{ runner.arch }}
path: |
dist/*.zip
dist/*.tar.gz
dist/*.deb
dist/*.rpm
release-artifacts:
needs: [ set-release-version, build-distribution ]
runs-on: ubuntu-latest
steps:
- name: 'Checkout GitHub repository'
uses: actions/checkout@v4
with:
ref: ${{ needs.set-release-version.outputs.HEAD }}
fetch-depth: 0
- name: 'Download all artifacts'
uses: actions/download-artifact@v4
with:
path: artifacts
pattern: artifacts-*
merge-multiple: true
- name: 'Set up Java'
uses: actions/setup-java@v3
with:
java-version: ${{ env.JAVA_VERSION }}
distribution: ${{ env.JAVA_DISTRO }}
- name: 'Cache Maven packages'
uses: actions/cache@v3.3.1
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- name: 'Configure Git'
run: |
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"
- name: 'Release with JReleaser'
env:
JRELEASER_GITHUB_TOKEN: ${{ secrets.PAT }}
JRELEASER_GPG_PUBLIC_KEY: ${{ secrets.GPG_PUBLIC_KEY }}
JRELEASER_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
JRELEASER_GPG_SECRET_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
JRELEASER_SDKMAN_CONSUMER_KEY: ${{ secrets.JRELEASER_SDKMAN_CONSUMER_KEY }}
JRELEASER_SDKMAN_CONSUMER_TOKEN: ${{ secrets.JRELEASER_SDKMAN_CONSUMER_TOKEN }}
run: ./mvnw -ntp -B --file ./cli/pom.xml -Prelease -DartifactsDir=artifacts jreleaser:full-release
- name: 'JReleaser output'
if: always()
uses: actions/upload-artifact@v4
with:
name: jreleaser-logs
path: |
target/jreleaser/trace.log
target/jreleaser/output.properties
- name: 'Commit Next Version'
env:
NEXT_VERSION: ${{ needs.set-release-version.outputs.NEXT_VERSION }}
run: |
./mvnw -ntp -B versions:set versions:commit -DnewVersion=${{ env.NEXT_VERSION }}
find . -name 'pom.xml' | xargs git add
git commit -m "ci: bump version for next iteration to ${{ env.NEXT_VERSION }} 🤖"
git push origin HEAD:${GITHUB_REF#refs/heads/}