From cda0cd2db1fb0ce5bb669aad1d17420914a76ab2 Mon Sep 17 00:00:00 2001 From: Carolyn Russell Date: Thu, 15 Dec 2022 18:34:46 -0700 Subject: [PATCH] ... Again (#478) --- .github/workflows/publish.yml | 13 ++++------- .github/workflows/release.yml | 41 +++++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+), 9 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 687f5da7..2d0523a1 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,10 +1,6 @@ name: Publish on: - workflow_run: - workflows: [ Release ] - types: - - completed release: types: [ created ] push: @@ -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 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b0c14879..f1b3765a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -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