Skip to content

Release publishing #3

Release publishing

Release publishing #3

Workflow file for this run

name: Prepare Release
on:
pull_request:
env:
NEXUS_SDK_REF: release-publishing
NEXUS_SDK_TAG: v0.1.0-alpha1
# workflow_dispatch:
# inputs:
# tag:
# type: string
# description: "Release version tag (e.g. v1.2.3)"
# required: true
# ref:
# type: string
# description: "Git ref from which to release"
# required: true
# default: "main"
# do_publish_jars:
# type: boolean
# description: "Publish Java artifacts for staging"
# required: true
# default: "true"
# env:
# NEXUS_SDK_REF: ${{ github.event.inputs.ref }}
# NEXUS_SDK_TAG: ${{ github.event.inputs.tag }}
jobs:
create_draft_release:
name: Create Github draft release
runs-on: ubuntu-latest
steps:
- name: Audit gh version
run: gh --version
- name: Check for existing release
id: check_release
run: |
echo "::echo::on"
gh release view --repo "$GITHUB_REPOSITORY" "$NEXUS_SDK_TAG" \
&& echo "::set-output name=already_exists::true" \
|| echo "::set-output name=already_exists::false"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Checkout repo
if: steps.check_release.outputs.already_exists == 'false'
uses: actions/checkout@v4
with:
ref: ${{ env.NEXUS_SDK_REF }}
- name: Create release
if: steps.check_release.outputs.already_exists == 'false'
run: >
gh release create
"$NEXUS_SDK_REF"
--draft
--repo "$GITHUB_REPOSITORY"
--title "$NEXUS_SDK_TAG"
--target "$NEXUS_SDK_REF"
--generate-notes
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
publish_java_artifacts:
name: Publish Java artifacts
# if: ${{ github.event.inputs.do_publish_jars == 'true' }}
runs-on: ubuntu-latest
needs: create_draft_release
steps:
- name: Checkout repo
uses: actions/checkout@v4
with:
ref: ${{ env.NEXUS_SDK_REF }}
- name: Set up Java
uses: actions/setup-java@v4
with:
java-version: "11"
distribution: "temurin"
- name: Set up Gradle
uses: gradle/actions/setup-gradle@v3
- name: Stage
run: ./gradlew nexus-sdk:publishToMavenCentral --no-configuration-cache
env:
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.SIGNING_IN_MEMORY_KEY }}
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.SIGNING_IN_MEMORY_KEY_PASSWORD }}