Skip to content

Commit

Permalink
feat(ci): rename workflows, improve manual maven publish
Browse files Browse the repository at this point in the history
  • Loading branch information
paullatzelsperger committed Jul 23, 2024
1 parent 0496320 commit 68fa9bb
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@


---
name: "Create Docker images"
name: "Create and publish Docker images"

on:
workflow_dispatch:
Expand All @@ -40,7 +40,7 @@ concurrency:

jobs:
create-docker-image:
name: "Create Docker Images for the ControlPlane"
name: "Build and push images"
runs-on: ubuntu-latest
strategy:
fail-fast: false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@


---
name: "Manually publish Maven Artefacts to OSSRH"
name: "Publish Maven Artefacts to OSSRH"

on:
workflow_dispatch:
inputs:
version:
required: false
description: 'a semver string denoting the version. Append -SNAPSHOT for snapshots. If ommitted, the version is taken from gradle.properties'
description: 'a semver string denoting the version. Append -SNAPSHOT for snapshots. If omitted, the version is taken from gradle.properties'

concurrency:
# cancel only running jobs on pull requests
Expand Down Expand Up @@ -58,12 +58,25 @@ jobs:
OSSRH_PASSWORD: ${{ secrets.ORG_OSSRH_PASSWORD }}
OSSRH_USER: ${{ secrets.ORG_OSSRH_USERNAME }}
run: |-
if [ -z ${{ inputs.version }} ];
then
# check if version input was specified, else read from gradle.properties
if [ ! -z ${{ inputs.version }} ];
then
VERSION=${{ inputs.version }}
echo "Publishing using version from parameter: $VERSION"
else
VERSION=$(./gradlew properties -q | grep "version:" | awk '{print $2}')
echo "Publishing using version from gradle.properties: $VERSION"
./gradlew publishToSonatype closeAndReleaseSonatypeStagingRepository --no-parallel -Pversion=$VERSION -Psigning.gnupg.executable=gpg -Psigning.gnupg.passphrase="${{ secrets.ORG_GPG_PASSPHRASE }}"
else
echo "Publishing using version from parameter: ${{ inputs.version }}"
./gradlew publishToSonatype closeAndReleaseSonatypeStagingRepository --no-parallel -Pversion=${{ inputs.version }} -Psigning.gnupg.executable=gpg -Psigning.gnupg.passphrase="${{ secrets.ORG_GPG_PASSPHRASE }}"
fi
# check if the version is a SNAPSHOT, and if not, append command to close staging repo
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="${{ secrets.ORG_GPG_PASSPHRASE }}"

0 comments on commit 68fa9bb

Please sign in to comment.