Skip to content

chore(release): 0.1.7 πŸŽ‰ #7

chore(release): 0.1.7 πŸŽ‰

chore(release): 0.1.7 πŸŽ‰ #7

Workflow file for this run

# 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
#
name: Maven Release
on:
# Triggers the workflow on push request events but only for tag versions
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:
# The e2e-test job first verifies the release with multiple fusionauth versions
e2e-test:
uses: ./.github/workflows/e2e-test-fusionauth-matrix-android-latest.yml
# The create_staging_repository job creates a repository in sonatype used in later 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@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 }}
# The publish job builds and publishes the release in to sonatype staging repository
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 and e2e-test job
needs: [create_staging_repository,e2e-test]
# 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
# The finalize job checks for the success for failure of previous jobs and then either discards or releases the published build
finalize:
runs-on: ubuntu-latest
needs: [create_staging_repository,publish,e2e-test]
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 }}