Skip to content

Commit

Permalink
Add inputs
Browse files Browse the repository at this point in the history
  • Loading branch information
gnodet committed Jul 24, 2024
1 parent c8418ef commit ac95d7c
Showing 1 changed file with 32 additions and 11 deletions.
43 changes: 32 additions & 11 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,41 @@
name: Manual Run automatic Maven Release
name: Manual Maven Release

on: workflow_dispatch
on:
workflow_dispatch:
inputs:
version:
description: The version to release (will be inferred from the pom version by default).
required: false
next-version:
description: The next developement version (will be inferred from the pom version by default).
required: false
java-version:
description: The java version to use
required: false
default: 22
distribution:
description: The java distribution to use.
required: false
default: temurin
maven-version:
description: The Maven version to use
required: false
default: 3.9.8

jobs:
release:
name: Release to Maven Central
runs-on: ubuntu-latest
steps:

- name: Checkout ${{ github.ref_name }}
uses: actions/checkout@v4

- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '22'
distribution: ${{ github.event.inputs.distribution }}
java-version: ${{ github.event.inputs.java-version }}
cache: maven
server-id: central
server-username: MAVEN_USER
Expand All @@ -25,7 +46,7 @@ jobs:
- name: Setup Maven
uses: stCarolas/setup-maven@v5
with:
maven-version: '3.9.8'
maven-version: ${{ github.event.inputs.maven-version }}

- name: Import GPG key
uses: crazy-max/ghaction-import-gpg@v6
Expand All @@ -35,7 +56,7 @@ jobs:
git_config_global: true
git_user_signingkey: true
git_commit_gpgsign: true
fingerprint: '0181A4828FA27B6BE6F1F5A68611CD28F472E006'
fingerprint: ${{ secrets.MAVEN_GPG_KEY_FINGERPRINT }}

- name: Diag
run: |
Expand All @@ -61,23 +82,23 @@ jobs:
run: |
gh extension install valeriobelli/gh-milestone
version=$(mvn -q -DforceStdout help:evaluate -N -Dexpression=project.version | sed -rn 's/([^-]+)(-SNAPSHOT|)$/\1/p')
echo "VERSION=$version" >> "$GITHUB_OUTPUT"
echo "version=$version" >> "$GITHUB_OUTPUT"
- name: Release
env:
MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
MAVEN_GPG_KEY_FINGERPRINT: '0x0181A4828FA27B6BE6F1F5A68611CD28F472E006!'
MAVEN_GPG_KEY_FINGERPRINT: ${{ secrets.MAVEN_GPG_KEY_FINGERPRINT }}
MAVEN_USER: ${{ secrets.NEXUS_USER }}
MAVEN_PASSWORD: ${{ secrets.NEXUS_PASSWORD }}
run: |
mvn -B release:prepare release:perform -Darguments="-DskipTests"
mvn -B release:prepare release:perform -Darguments="-DskipTests" -DreleaseVersion=${{ github.event.inputs.version }} -DdevelopmentVersion=${{ github.event.inputs.next-version }}
- name: Post release
env:
GH_TOKEN: ${{ github.token }}
shell: bash
run: |
version=${{ steps.pre-release.outputs.VERSION }}
version=${{ steps.pre-release.outputs.version }}
echo "Trying to find milestone $version"
milestone=$(gh milestone list --json id,title,state --jq "map_values(select(.title == \"${version}\" and .state == \"OPEN\")).[].number")
if [ ! -z "$milestone" ]; then
Expand All @@ -89,7 +110,7 @@ jobs:
echo "Preparing development $version"
echo "Trying to find milestone $version"
milestone=$(gh milestone list --json id,title,state --jq "map_values(select(.title == \"${version}\" and .state == \"OPEN\")).[].number")
if [ ! -z "$milestone" ]; then
if [ -z "$milestone" ]; then
echo "Creating milestone $version"
gh milestone create --title $milestone
fi
Expand Down

0 comments on commit ac95d7c

Please sign in to comment.