This action closes an existing staged repository, and if the sonatype process ends by closing the staged repository properly it will release the artifacts on Maven Central.
Here is an example of how to use this action in your workflows.
on: [push]
jobs:
create_staging_repository:
#...
build:
needs: create_staging_repository
# ...
release:
runs-on: ubuntu-latest
needs: [create_staging_repository, build]
if: ${{ always() && needs.build.result == 'success' }}
steps:
- name: Release
# replace '@main' with the latest commit sha, see https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions#using-third-party-actions
uses: nexus-actions/release-nexus-staging-repo@main
with:
username: ${{ secrets.SONATYPE_USERNAME }}
password: ${{ secrets.SONATYPE_PASSWORD }}
staging_repository_id: ${{ needs.create_staging_repository.outputs.repository-id }}
[description]: Closed ${{ github.repository }}#${{ github.run_number }}
[close_only]: 'true'
The different arguments are:
username
: Your Sonatype username, same the Sonatype Jira onepassword
: Your Sonatype password, same the Sonatype Jira onestaging_repository_id
: The ID of the staged repository to drop.description
: The description to use for the closed repository. Defaults to"Closed by Github Actions"
.base_url
: The url of your nexus repository, default to OSSRH (https://oss.sonatype.org/service/local/)close_only
: This option disable the auto-release process, default is'false'
See the nexus-actions-demo repo for more details and use cases.
- Martin Bonnin from Apollo GraphQL
- Romain Boisselle from Kodein Koders