Skip to content

Release

Release #7

Workflow file for this run

name: Release
on:
workflow_dispatch:
inputs:
version:
description: 'Release version (e.g., 1.0.0)'
required: true
type: string
jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write # Required to create releases and push commits
# Uncomment to add an approval gate before releasing:
# environment: jreleaser
env:
JRELEASER_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
JRELEASER_GPG_PUBLIC_KEY: ${{ secrets.GPG_PUBLIC_KEY }}
JRELEASER_GPG_SECRET_KEY: ${{ secrets.GPG_SECRET_KEY }}
JRELEASER_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
JRELEASER_MAVENCENTRAL_USERNAME: ${{ secrets.MAVENCENTRAL_USERNAME }}
JRELEASER_MAVENCENTRAL_PASSWORD: ${{ secrets.MAVENCENTRAL_PASSWORD }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0 # Full history for changelog generation
- name: Set up JDK 22
uses: actions/setup-java@v4
with:
java-version: '22'
distribution: 'temurin'
cache: maven
- name: Set release version
run: |
./mvnw --no-transfer-progress --batch-mode versions:set -DnewVersion=${{ inputs.version }} -DprocessAllModules=true versions:commit
find . -name "README.md" -exec sed -i \
-e 's/\(org\.codejive\.miniterm:[^:]*\):[0-9][a-zA-Z0-9._-]*/\1:${{ inputs.version }}/g' \
-e 's|<version>[^<]*</version>|<version>${{ inputs.version }}</version>|g' \
{} \;
find examples -type f -exec sed -i \
-e 's/\(org\.codejive\.miniterm:[^:]*\):[0-9][a-zA-Z0-9._-]*/\1:${{ inputs.version }}/g' \
{} \;
- name: Build and deploy to staging
run: ./mvnw --no-transfer-progress --batch-mode clean deploy -Prelease
- name: Commit release version
run: |
git config user.email "github-actions[bot]@users.noreply.github.com"
git config user.name "github-actions[bot]"
git add -A
git commit -m "ci: Releasing version ${{ inputs.version }}"
git push
- name: Run JReleaser
run: ./mvnw --no-transfer-progress --batch-mode -N jreleaser:full-release
- name: Set next development version
run: |
./mvnw --no-transfer-progress --batch-mode build-helper:parse-version versions:set "-DnewVersion=\${parsedVersion.majorVersion}.\${parsedVersion.minorVersion}.\${parsedVersion.nextIncrementalVersion}-SNAPSHOT" -DprocessAllModules=true versions:commit
- name: Commit next development version
run: |
git add -A
git commit -m "ci: Prepare for next development iteration"
git push
- name: Upload JReleaser output
if: always()
uses: actions/upload-artifact@v4
with:
name: jreleaser-output
path: |
target/jreleaser/trace.log
target/jreleaser/output.properties
retention-days: 7