build: setting secrets in setup-java action #14
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release | |
on: | |
push: | |
tags: | |
- "[0-9]+.[0-9]+.[0-9]+" | |
workflow_dispatch: | |
inputs: | |
tag: | |
description: "Git tag to release from" | |
required: true | |
type: string | |
jobs: | |
publish: | |
env: | |
SPHA_VERSION: ${{ inputs.tag || github.ref_name }} | |
permissions: | |
contents: write | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4 | |
with: | |
ref: ${{ env.SPHA_VERSION }} | |
- name: Set up Apache Maven Central | |
uses: actions/setup-java@8df1039502a15bceb9433410b1a100fbe190c53b | |
with: # running setup-java again overwrites the settings.xml | |
distribution: 'temurin' | |
java-version: '21' | |
server-id: 'ossrh' # must match the serverId configured for the nexus-staging-maven-plugin | |
server-username: ORG_GRADLE_PROJECT_OSSRHUsername # Env var that holds your OSSRH user name | |
server-password: ORG_GRADLE_PROJECT_OSSRHPassword # Env var that holds your OSSRH user pw | |
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY_JN }} # Substituted with the value stored in the referenced secret | |
gpg-passphrase: ORG_GRADLE_PROJECT_signingPassword # Env var that holds the key's passphrase | |
- name: Setup Gradle | |
uses: gradle/actions/setup-gradle@d156388eb19639ec20ade50009f3d199ce1e2808 # v4 | |
- name: Publish to OSSRH | |
env: | |
ORG_GRADLE_PROJECT_OSSRHUsername: ${{ secrets.SONATYPE_USER }} | |
ORG_GRADLE_PROJECT_OSSRHPassword: ${{ secrets.SONATYPE_PW }} | |
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.GPG_PRIVATE_KEY_JN }} | |
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.GPG_PRIVATE_KEY_PASSPHRASE_JN }} | |
run: ./gradlew publish | |
- name: Generate Release Notes | |
run: ./gradlew -q printChangeLog > RELEASE_NOTES.md | |
- name: Create GitHub Release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
gh release create $SPHA_VERSION --notes-file RELEASE_NOTES.md |