Skip to content

Commit

Permalink
ci(maven): publish snapshots to Maven Central without release (#393)
Browse files Browse the repository at this point in the history
  • Loading branch information
ebaron authored May 14, 2024
1 parent 531b314 commit 75f1429
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 9 deletions.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@ name: Publish a new Maven Central release

on:
workflow_call:
workflow_dispatch:
# inputs:
# version:
# description: 'Release version'
# required: true
inputs:
publish-cmd:
description: 'Command to perform publish'
required: true

jobs:
build:
Expand Down Expand Up @@ -36,4 +35,4 @@ jobs:
JRELEASER_NEXUS2_USERNAME: ${{ secrets.MAVEN_CENTRAL_NEXUS2_USERNAME }}
JRELEASER_NEXUS2_PASSWORD: ${{ secrets.MAVEN_CENTRAL_NEXUS2_PASSWORD }}
JRELEASER_GITHUB_TOKEN: ${{ secrets.SUBMODULE_TOKEN }}
run: ./release.sh
run: ${{ inputs.publish-cmd }}
14 changes: 11 additions & 3 deletions .github/workflows/push-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,14 @@ jobs:
distribution: 'temurin'
- run: mvn -B -U clean verify
publish-snapshot:
uses: ./.github/workflows/maven-central-release.yml
secrets: inherit
if: github.repository_owner == 'cryostatio'
steps:
- id: get-version
run: |
PROJECT_VERSION="$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)"
echo "project-version=${PROJECT_VERSION}" >> "${GITHUB_OUTPUT}"
- id: run-publish
uses: ./.github/workflows/maven-central-publish.yml
secrets: inherit
with:
publish-cmd: './mvnw -Prelease deploy jreleaser:deploy'
if: ${{ github.repository_owner == 'cryostatio' && endsWith(steps.get-version.outputs.project-version, '-SNAPSHOT') }}
17 changes: 17 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Inspired from https://foojay.io/today/how-to-release-a-java-module-with-jreleaser-to-maven-central-with-github-actions/
name: Publish a new Maven Central release

on:
workflow_dispatch:
# inputs:
# version:
# description: 'Release version'
# required: true

jobs:
publish-release:
uses: ./.github/workflows/maven-central-publish.yml
secrets: inherit
with:
publish-cmd: './release.sh'
if: ${{ github.repository_owner == 'cryostatio' }}

0 comments on commit 75f1429

Please sign in to comment.