TraceLog/.github/workflows/release.yml

71 lines
2.7 KiB
YAML

on:
push:
tags:
- v*
name: Release to Maven Central
jobs:
create_staging_repository:
runs-on: ubuntu-latest
name: Create staging repository
outputs:
repository_id: ${{ steps.create.outputs.repository_id }}
steps:
- id: create
uses: nexus-actions/create-nexus-staging-repo@3e5e7209801629febdcf75541a4898710d28df9a # v1.2
with:
username: msfjarvis
password: ${{ secrets.SONATYPE_NEXUS_PASSWORD }}
staging_profile_id: ${{ secrets.NEXUS_PUBLISH_STAGING_PROFILE_ID }}
description: ${{ github.repository }}/${{ github.workflow }}#${{ github.run_number }}
publish:
runs-on: macos-14
needs: create_staging_repository
steps:
- name: Checkout repository
uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3
- name: Set up JDK
uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # v4.2.1
with:
distribution: temurin
java-version: 18
- name: Cache Kotlin/Native compiler
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
with:
path: ~/.konan
key: ${{ runner.os }}-gradle-${{ hashFiles('gradle/wrapper/gradle-wrapper.properties', 'gradle/libs.versions.toml') }}
- name: Publish
uses: gradle/gradle-build-action@e2097ccd7e8ed48671dc068ac4efa86d25745b39 # v3.3.1
with:
arguments: publish :gradle-plugin:publish
env:
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.NEXUS_PUBLISH_SIGNING_KEY }}
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.NEXUS_PUBLISH_SIGNING_KEY_PASSWORD }}
SONATYPE_USERNAME: msfjarvis
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_NEXUS_PASSWORD }}
SONATYPE_REPOSITORY_ID: ${{ needs.create_staging_repository.outputs.repository_id }}
finalize:
runs-on: ubuntu-latest
needs: [create_staging_repository, publish]
if: ${{ always() && needs.create_staging_repository.result == 'success' }}
steps:
- name: Discard
if: ${{ needs.publish.result != 'success' }}
uses: nexus-actions/drop-nexus-staging-repo@fe83783967a063540320ace3c8942608246705a1 # v1
with:
username: msfjarvis
password: ${{ secrets.SONATYPE_NEXUS_PASSWORD }}
staging_repository_id: ${{ needs.create_staging_repository.outputs.repository_id }}
- name: Release
if: ${{ needs.publish.result == 'success' }}
uses: nexus-actions/release-nexus-staging-repo@36161f25ef98cc3821eabb11ab742d2e9d479e52 # v1.2
with:
username: msfjarvis
password: ${{ secrets.SONATYPE_NEXUS_PASSWORD }}
staging_repository_id: ${{ needs.create_staging_repository.outputs.repository_id }}