Skip to content

Commit

Permalink
... Again (#478)
Browse files Browse the repository at this point in the history
  • Loading branch information
minxylynx authored Dec 16, 2022
1 parent 08915a9 commit cda0cd2
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 9 deletions.
13 changes: 4 additions & 9 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
name: Publish

on:
workflow_run:
workflows: [ Release ]
types:
- completed
release:
types: [ created ]
push:
Expand Down Expand Up @@ -39,12 +35,11 @@ jobs:
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
GPG_PASSWORD: ${{ secrets.OSSRH_GPG_SECRET_KEY_PASSWORD }}
run: |
VERSION=noop
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
# If its a release, we use that
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
VERSION=$(echo $VERSION | sed -e 's/^v//')
if [[ $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')
if [ "${{ github.event.repository.default_branch }}" = "$VERSION" ]; then
VERSION=$SNAPSHOT
Expand Down
41 changes: 41 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,44 @@ jobs:
draft: false
prerelease: false
body_path: RELEASE_CHANGELOG.md

publish-libraries:
needs: release
runs-on: ubuntu-latest
name: Publishing Explorer Libraries
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Java Setup
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: 11
server-id: github

- name: GPG Setup
env:
GPG_KEY: ${{ secrets.OSSRH_GPG_SECRET_KEY }}
run: |
export GPG_TTY=$(tty)
echo -n "$GPG_KEY" | base64 --decode | gpg --batch --import
gpg --list-secret-keys --keyid-format LONG
echo -n "$GPG_KEY" | base64 --decode > $GITHUB_WORKSPACE/release.gpg
- name: Build and Publish
env:
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
GPG_PASSWORD: ${{ secrets.OSSRH_GPG_SECRET_KEY_PASSWORD }}
run: |
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
VERSION=$(echo $VERSION | sed -e 's/^v//')
echo version::${VERSION}
./gradlew publishToSonatype \
$(if [ $VERSION = $SNAPSHOT ]; then echo 'closeSonatypeStagingRepository'; else echo 'closeAndReleaseSonatypeStagingRepository'; fi) \
-Pversion=${VERSION} \
-PartifactVersion=${VERSION} \
-Psigning.keyId=B7D30ABE \
-Psigning.password="$GPG_PASSWORD" \
-Psigning.secretKeyRingFile=$GITHUB_WORKSPACE/release.gpg \
--info

0 comments on commit cda0cd2

Please sign in to comment.