chore(release): 0.1.4 π #4
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
# This workflow uses actions that are not certified by GitHub. | |
# They are provided by a third-party and are governed by | |
# separate terms of service, privacy policy, and support | |
# documentation. | |
# This workflow performs a Maven Release | |
# | |
# Scans are triggered: | |
# 1. On every push to default and protected branches | |
# 2. On every Pull Request targeting the default branch | |
# 3. On a weekly schedule | |
# 4. Manually, on demand, via the "workflow_dispatch" event | |
# | |
name: Maven Release | |
on: | |
# Triggers the workflow on push or pull request events but only for default and protected branches | |
push: | |
tags: | |
- 'v[0-9]+.[0-9]+.[0-9]' | |
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | |
jobs: | |
# This workflow contains a single job called "scan" | |
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@main | |
with: | |
username: ${{ secrets.NXRM_TOKEN_USERNAME }} | |
password: ${{ secrets.NXRM_TOKEN_PASSWORD }} | |
staging_profile_id: ${{ secrets.NXRM_PROFILE_ID }} | |
description: ${{ github.repository }}/${{ github.workflow }}#${{ github.run_number }} | |
publish: | |
name: Maven Release | |
permissions: | |
# required for all workflows | |
security-events: write | |
# only required for workflows in private repositories | |
actions: read | |
contents: read | |
# The type of runner that the job will run on | |
runs-on: ubuntu-latest | |
# Requires the staging_profile_id | |
needs: create_staging_repository | |
# Steps represent a sequence of tasks that will be executed as part of the job | |
steps: | |
# Sets up JDK as a prerequisite to run Gradle | |
- name: Setup Java | |
uses: actions/[email protected] | |
with: | |
java-version: '17' | |
distribution: 'zulu' | |
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
- name: Checkout repository | |
uses: actions/[email protected] | |
# Sets up Gradle as a prerequisite to run Maven Release | |
- name: Setup Gradle | |
uses: gradle/actions/[email protected] | |
with: | |
gradle-home-cache-cleanup: true | |
# Performs a Local Maven Release | |
- name: Run Maven Local Release | |
env: | |
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.GPG_SIGNING_KEY }} | |
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.GPG_SIGNING_PASSWORD }} | |
run: ./gradlew publishReleasePublicationToMavenLocal | |
# Performs a Maven Release to oss.sonatype.org | |
- name: Run Maven Release to OSSRH | |
env: | |
ossrhUsername: ${{ secrets.NXRM_TOKEN_USERNAME }} | |
ossrhPassword: ${{ secrets.NXRM_TOKEN_PASSWORD }} | |
ORG_GRADLE_PROJECT_ossrhUsername: ${{ secrets.NXRM_TOKEN_USERNAME }} | |
ORG_GRADLE_PROJECT_ossrhPassword: ${{ secrets.NXRM_TOKEN_PASSWORD }} | |
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.GPG_SIGNING_KEY }} | |
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.GPG_SIGNING_PASSWORD }} | |
SONATYPE_REPOSITORY_ID: ${{ needs.create_staging_repository.outputs.repository_id }} | |
run: ./gradlew clean publishReleasePublicationToOSSRHRepository | |
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@main | |
with: | |
username: ${{ secrets.NXRM_TOKEN_USERNAME }} | |
password: ${{ secrets.NXRM_TOKEN_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@main | |
with: | |
username: ${{ secrets.NXRM_TOKEN_USERNAME }} | |
password: ${{ secrets.NXRM_TOKEN_PASSWORD }} | |
staging_repository_id: ${{ needs.create_staging_repository.outputs.repository_id }} |