Skip to content

fix publish steps (#229) #443

fix publish steps (#229)

fix publish steps (#229) #443

Workflow file for this run

name: release
on:
push:
branches:
- main
tags:
- "*.*.*"
- "v*.*.*"
- "*.*.*-*"
- "v*.*.*-*"
jobs:
e2e:
uses: ./.github/workflows/_e2e_multi.yml
with:
notify_slack_if_failed: false
release:
if: startsWith( github.ref, 'refs/tags/')
needs:
- e2e
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Create release
if: startsWith( github.ref, 'refs/tags/')
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false
publish:
if: startsWith( github.ref, 'refs/tags/')
needs:
- e2e
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
with:
fetch-depth: 1
- name: Prepare for publish
run: |
./gradlew clean
echo "${PGP_PRIVATE_KEY}" > private_key.txt
gpg --import --batch private_key.txt
rm -f private_key.txt
gpg --pinentry-mode loopback --passphrase "${GPG_PASSPHRASE}" --export-secret-keys -o ~/.gnupg/secring.gpg
cat << EOF > ~/.gradle/gradle.properties
org.gradle.daemon=true
signing.keyId=${GPG_KEYID}
signing.password=${GPG_PASSPHRASE}
signing.secretKeyRingFile=${HOME}/.gnupg/secring.gpg
sonatypeUsername=${SONATYPE_USERNAME}
sonatypePassword=${SONATYPE_PASSWORD}
nexusUsername=${SONATYPE_USERNAME}
nexusPassword=${SONATYPE_PASSWORD}
EOF
env:
GPG_KEYID: ${{ secrets.GPG_KEYID }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
PGP_PRIVATE_KEY: ${{ secrets.PGP_PRIVATE_KEY }}
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
- name: Publish
run: |
./gradlew clean
make vald
./gradlew build -x test --stacktrace
./gradlew publish -Prelease --stacktrace
sleep 120
./gradlew closeAndReleaseRepository --stacktrace
env:
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
notify_release_status:
name: Notify release status to slack
runs-on: ubuntu-latest
needs:
- publish
- release
if: ${{ success() || failure() }}
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/notify-slack
with:
author_name: Release vald-java-client
slack_notify_webhook_url: ${{ secrets.SLACK_WEBHOOK_URL }}