Skip to content

Use jreleaser, remove release-drafter. #6

Use jreleaser, remove release-drafter.

Use jreleaser, remove release-drafter. #6

Workflow file for this run

name: Release
on:
workflow_dispatch:
inputs:
version:
description: 'Release version'
required: true
version-fragment:
description: 'Version fragment to increase for next development cycle'
required: false
default: 'minor'
env:
BOT_USER_NAME: eclipse-cbi-bot
BOT_EMAIL: [email protected]
JAVA_VERSION: '17'
JAVA_DISTRO: 'temurin'
JRELEASER_VERSION: '1.9.0'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: false
jobs:
precheck:
runs-on: ubuntu-latest
permissions:
contents: write
# don't run this workflow in forks
# if: github.repository == 'eclipse-cbi/macos-notarization-service'
# if: success() && github.ref == 'refs/heads/main'
outputs:
version: ${{ steps.prepare-release.outputs.VERSION }}
steps:
- name: Setup Git User
run: |
git config --global user.name '${{ env.BOT_USER_NAME }}'
git config --global user.email '${{ env.BOT_EMAIL }}'
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
ref: ${{ github.ref }}
fetch-depth: 0
- name: Setup Java
uses: actions/setup-java@0ab4596768b603586c0de567f2430c30f5b0d2b0 # v3.13.0
with:
java-version: ${{ env.JAVA_VERSION }}
distribution: ${{ env.JAVA_DISTRO }}
cache: maven
- name: Prepare release
id: prepare-release
shell: bash
run: |
PROJECT_VERSION="$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)"
RELEASE_VERSION="${{ github.event.inputs.version }}"
echo "PROJECT_VERSION=$(echo $PROJECT_VERSION)" >> $GITHUB_OUTPUT
echo "VERSION=$RELEASE_VERSION" >> $GITHUB_OUTPUT
echo "Project version: $PROJECT_VERSION"
echo "Release version: $RELEASE_VERSION"
git show-ref --tags --verify "refs/tags/v${RELEASE_VERSION}"
if git show-ref --tags --verify --quiet "refs/tags/v${RELEASE_VERSION}"; then
echo "Release Tag 'v${TAG}' already exists, aborting."
exit 1
fi
if [ "$PROJECT_VERSION" != "$RELEASE_VERSION" ]; then
./mvnw -B versions:set versions:commit -DnewVersion=$RELEASE_VERSION
git commit -a -m "Releasing version $RELEASE_VERSION"
git push origin ${{ github.ref }}
fi
release:
runs-on: ubuntu-latest
needs: ['precheck']
permissions:
contents: write
actions: read
packages: write
id-token: write
steps:
- uses: jreleaser/release-action/.github/workflows/builder_slsa3.yml@java
with:
project-version: ${{ needs.precheck.outputs.version }}
branch: ${{ github.ref_name }}
jreleaser-version: ${{ env.JRELEASER_VERSION }}
java-version: ${{ env.JAVA_VERSION }}
java-distribution: ${{ env.JAVA_DISTRO }}
rekor-log-public: true
secrets:
github-token: ${{ secrets.GITHUB_TOKEN }}
prepare-for-next-development-cycle:
runs-on: ubuntu-latest
needs: ['precheck', 'release']
permissions:
contents: write
steps:
- name: Setup Git User
run: |
git config --global user.name '${{ env.BOT_USER_NAME }}'
git config --global user.email '${{ env.BOT_EMAIL }}'
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
ref: ${{ github.ref }}
- name: Setup Java
uses: actions/setup-java@0ab4596768b603586c0de567f2430c30f5b0d2b0 # v3.13.0
with:
java-version: ${{ env.JAVA_VERSION }}
distribution: ${{ env.JAVA_DISTRO }}
cache: maven
- id: increase-semver
uses: ./.github/actions/increase-semver
with:
current-version: ${{ needs.precheck.outputs.version }}
version-fragment: ${{ github.event.inputs.version-fragment }}
- name: Update next development version in POMs
run: |
./mvnw -B versions:set versions:commit -DnewVersion=${{ steps.increase-semver.outputs.next-version }}-SNAPSHOT -DgenerateBackupPoms=false
git commit -a -m "Prepare for next development cycle"
git push origin ${{ github.ref }}