Skip to content

Commit

Permalink
Publish Fix 5 (#474)
Browse files Browse the repository at this point in the history
  • Loading branch information
minxylynx authored Dec 15, 2022
1 parent 6d3a0e2 commit fb461e2
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
name: Publish

on:
release:
types: [ created ]
push:
branches: [ main ]
tags:
- "v[0-9]+.[0-9]+.[0-9]+" # Push events to matching v*, i.e. v1.0, v20.15.10
- "v[0-9]+.[0-9]+.[0-9]+-rc*" # Push events to matching v*, i.e. v1.0-rc1, v20.15.10-rc5

jobs:
publish-libraries:
Expand Down Expand Up @@ -37,20 +36,21 @@ jobs:
GPG_PASSWORD: ${{ secrets.OSSRH_GPG_SECRET_KEY_PASSWORD }}
run: |
VERSION=noop
if [[ $GITHUB_REF == refs/tags/* ]]; then
VERSION=${GITHUB_REF#refs/tags/}
elif [[ $GITHUB_REF == refs/heads/* ]]; then
SNAPSHOT=1.0-SNAPSHOT
if [[ $GITHUB_REF == refs/tags/* ]]; then # If its a tag, then its a release, and we use that
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
VERSION=$(echo $VERSION | sed -e 's/^v//')
elif [[ $GITHUB_REF == refs/heads/* ]]; then # If its a head branch, check if its the default, and set to snapshot version
VERSION=$(echo ${GITHUB_REF#refs/heads/} | sed -r 's#/+#-#g')
echo ::set-output name=branch::${VERSION}
if [ "${{ github.event.repository.default_branch }}" = "$VERSION" ]; then
VERSION=latest
VERSION=$SNAPSHOT
fi
fi
echo version::${VERSION}
./gradlew publishToSonatype \
$(if [ $VERSION = $SNAPSHOT ]; then echo 'closeSonatypeStagingRepository'; else echo 'closeAndReleaseSonatypeStagingRepository'; fi) \
-Pversion=${VERSION} \
-PartifactVersion=${VERSION} \
closeAndReleaseSonatypeStagingRepository \
-Psigning.keyId=B7D30ABE \
-Psigning.password="$GPG_PASSWORD" \
-Psigning.secretKeyRingFile=$GITHUB_WORKSPACE/release.gpg \
Expand Down

0 comments on commit fb461e2

Please sign in to comment.