7.0.6 #1138
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 uploads the releases to the Maven Central Repository | |
name: Publish Release to Maven Central | |
on: | |
release: | |
types: | |
- released | |
- prereleased | |
env: | |
SEMANTIC_VERSION: ${{ github.event.release.tag_name }} | |
SONATYPE_PROFILE_ID: 33839da457341f | |
jobs: | |
upload-maven-central: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # v4.2.1 | |
with: | |
distribution: 'temurin' | |
java-version: 17 | |
cache: 'gradle' | |
- name: Build and Sign packages | |
run: ./gradlew --parallel signMavenPublication | |
env: | |
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.SIGNING_PRIVATE_KEY }} | |
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.SIGNING_PRIVATE_KEY_SECRET }} | |
- name: Create Staging Repository | |
id: create-staging-repo | |
run: | | |
ID=`echo "<promoteRequest><data><description>Created from GitHub Action for version $SEMANTIC_VERSION</description></data></promoteRequest>" \ | |
| curl -X POST \ | |
-d @- \ | |
-u $SDA_SONATYPE_USER:$SDA_SONATYPE_PASSWORD \ | |
-H "Content-Type:application/xml" \ | |
https://oss.sonatype.org/service/local/staging/profiles/$SONATYPE_PROFILE_ID/start \ | |
| sed -n 's:.*<stagedRepositoryId>\(.*\)</stagedRepositoryId>.*:\1:p'` | |
echo "STAGING_PROFILE_ID=$ID" >> $GITHUB_OUTPUT | |
env: | |
SDA_SONATYPE_USER: ${{ secrets.SDA_SONATYPE_USER }} | |
SDA_SONATYPE_PASSWORD: ${{ secrets.SDA_SONATYPE_PASSWORD }} | |
- name: Upload to Maven Central | |
run: ./gradlew publishMavenPublicationToMavenCentralRepository closeAndReleaseRepository | |
env: | |
SDA_SONATYPE_USER: ${{ secrets.SDA_SONATYPE_USER }} | |
SDA_SONATYPE_PASSWORD: ${{ secrets.SDA_SONATYPE_PASSWORD }} | |
SONATYPE_STAGING_REPOSITORY_ID: ${{ steps.create-staging-repo.outputs.STAGING_PROFILE_ID }} | |
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.SIGNING_PRIVATE_KEY }} | |
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.SIGNING_PRIVATE_KEY_SECRET }} | |
- uses: 8398a7/action-slack@v3 | |
with: | |
status: custom | |
fields: workflow,job,commit,repo,ref,author,took | |
custom_payload: | | |
{ | |
username: 'Maven Central Upload', | |
icon_emoji: ':coffin-dance:', | |
attachments: [{ | |
color: 'danger', | |
text: `Maven Central Upload of sda-dropwizard-commons:${{ github.event.release.tag_name }} failed!\n\nWorkflow ${process.env.AS_WORKFLOW}`, | |
}] | |
} | |
env: | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }} | |
if: failure() |