-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: extract a publish-maven-artifacts composite action (#136)
- Loading branch information
Showing
3 changed files
with
67 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
name: "Publish Maven Artifacts" | ||
description: "Build and publish maven artifacts to repository" | ||
|
||
inputs: | ||
version: | ||
description: the version to be attached to the artifacts, if not specified, the one configured in the project will be used | ||
required: false | ||
ref: | ||
description: the git ref from which the artifacts will be built and published | ||
required: true | ||
gpg-private-key: | ||
description: the gpg private key used to publish | ||
required: true | ||
gpg-passphrase: | ||
description: the gpg passphrase used to publish | ||
required: true | ||
osshr-username: | ||
description: the OSSHR username | ||
required: true | ||
osshr-password: | ||
description: the OSSHR password | ||
required: true | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
|
||
- uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ inputs.ref }} | ||
|
||
- uses: eclipse-edc/.github/.github/actions/setup-build@main | ||
|
||
- uses: eclipse-edc/.github/.github/actions/import-gpg-key@main | ||
with: | ||
gpg-private-key: ${{ inputs.gpg-private-key }} | ||
|
||
- if: inputs.version != null | ||
shell: bash | ||
run: | | ||
sed -i 's#^version=.*#version=${{ inputs.version }}#g' $(find . -name "gradle.properties") | ||
- name: "Publish To OSSRH/MavenCentral" | ||
shell: bash | ||
env: | ||
OSSRH_USER: ${{ inputs.osshr-username }} | ||
OSSRH_PASSWORD: ${{ inputs.osshr-password }} | ||
run: |- | ||
VERSION=$(grep "version" gradle.properties | awk -F= '{print $2}') | ||
cmd="" | ||
if [[ $VERSION != *-SNAPSHOT ]] | ||
then | ||
cmd="closeAndReleaseSonatypeStagingRepository"; | ||
fi | ||
echo "Publishing Version $VERSION to Sonatype" | ||
./gradlew publishToSonatype ${cmd} --no-parallel -Pversion=$VERSION -Psigning.gnupg.executable=gpg -Psigning.gnupg.passphrase="${{ inputs.gpg-passphrase }}" | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters