-
Notifications
You must be signed in to change notification settings - Fork 1
45 lines (44 loc) · 1.55 KB
/
03_publish_to_maven.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
name: "03 - Publish to Maven Central"
on:
workflow_dispatch:
push:
branches:
- main
paths:
- CHANGELOG.md
jobs:
publish:
name: Publish Java SDK
runs-on: ubuntu-latest
steps:
- name: Tune GitHub-hosted runner network
uses: smorimoto/tune-github-hosted-runner-network@v1
- uses: actions/checkout@v4
- run: ./scripts/is_release.sh # fail the build if unreleased changes
- name: Set up Java
uses: actions/setup-java@v4
with:
java-version: "17"
distribution: "corretto"
cache: "gradle"
- uses: gradle/actions/setup-gradle@v3
- name: Publish to Sonatype (legacy)
run: |-
pwd
./gradlew publish --no-daemon
env:
MAVEN_USERNAME: ${{ secrets.ossrh_username }}
MAVEN_PASSWORD: ${{ secrets.ossrh_password }}
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.java_gpg_secret_key }}
ORG_GRADLE_PROJECT_signingPassphrase: ${{ secrets.java_gpg_passphrase }}
- uses: ravsamhq/notify-slack-action@v2
if: always() && env.SLACK_WEBHOOK_URL != ''
with:
status: ${{ job.status }}
token: ${{ secrets.github_access_token }}
notify_when: "failure"
notification_title: "Failed to Publish Maven Central Release"
message_format: "{emoji} *{workflow}* {status_message} in <{repo_url}|{repo}>"
footer: "Linked Repo <{repo_url}|{repo}> | <{run_url}|View Run>"
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}