Skip to content

Release Library

Release Library #16

Workflow file for this run

name: Release Library
on:
workflow_dispatch:
env:
ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.SONATYPE_USERNAME }}
ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.SONATYPE_PASSWORD }}
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.SIGNING_KEY }}
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.SIGNING_PASSWORD }}
ORG_GRADLE_PROJECT_isRelease: true
permissions:
contents: write
jobs:
release:
runs-on: macos-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Java
uses: actions/setup-java@v4
with:
distribution: 'corretto'
java-version: '17'
- name: Set up Gradle
uses: gradle/gradle-build-action@v3
- name: Setup jq
uses: dcarbone/install-jq-action@v2
- name: Create Nexus staging repository
id: create-nexus-staging
run: ./scripts/create-nexus-staging-repo.sh
env:
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
SONATYPE_STAGING_PROFILE_ID: ${{ secrets.SONATYPE_STAGING_PROFILE_ID }}
SONATYPE_DESCRIPTION: Created by GitHub Actions
- name: Publish artifacts to Sonatype
id: publish
run: ./gradlew publishAllPublicationsToSonatypeRepository
env:
ORG_GRADLE_PROJECT_sonatypeStagingRepositoryId: ${{ steps.create-nexus-staging.outputs.repository_id }}
- name: Discard Nexus staging repository
if: ${{ failure() && steps.publish.conclusion == 'failure' }}
run: ./scripts/drop-nexus-staging.sh
env:
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
SONATYPE_REPOSITORY_ID: ${{ steps.create-nexus-staging.outputs.repository_id }}
- name: Release Nexus repository
run: ./scripts/release-nexus-staging.sh
env:
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
SONATYPE_REPOSITORY_ID: ${{ steps.create-nexus-staging.outputs.repository_id }}
SONATYPE_DESCRIPTION: Closed by GitHub Actions
- name: Extract version from build.gradle.kts
id: extract_version
run: |
version=$(sed -n 's/.*version = "\([0-9.]*\).*/\1/p' compose-remember-setting/build.gradle.kts)
echo "VERSION=$version" >> $GITHUB_ENV
- name: Create GitHub Release
uses: ncipollo/release-action@v1
with:
token: ${{ secrets.TOKEN_RELEASES }}
tag: ${{ env.VERSION }}
commit: ${{ github.sha }}
generateReleaseNotes: true
makeLatest: true