-
Notifications
You must be signed in to change notification settings - Fork 1
58 lines (49 loc) · 1.84 KB
/
Copy pathrelease.yml
File metadata and controls
58 lines (49 loc) · 1.84 KB
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
46
47
48
49
50
51
52
53
54
55
56
57
58
name: release
# Publishes the library to Maven Central (Sonatype Central Portal) when a version tag is pushed,
# then creates the matching GitHub Release. Credentials and the signing key are read from repo
# secrets at publish time only -- see RELEASING.md for the one-time setup and how to cut a release.
on:
push:
tags:
- 'v*'
workflow_dispatch:
inputs:
version:
description: "Release version (without the 'v' prefix)"
required: true
type: string
permissions:
contents: write
jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Check out source
uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: "17"
- name: Set up Gradle
uses: gradle/actions/setup-gradle@v4
- name: Derive release version
id: version
run: |
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
echo "version=${{ inputs.version }}" >> "$GITHUB_OUTPUT"
else
echo "version=${GITHUB_REF_NAME#v}" >> "$GITHUB_OUTPUT"
fi
- name: Publish to Maven Central
env:
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.SIGNING_KEY }}
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.SIGNING_KEY_PASSWORD }}
run: ./gradlew publishToMavenCentral -PreleaseVersion=${{ steps.version.outputs.version }} --no-daemon --no-configuration-cache
- name: Create GitHub Release
if: github.event_name == 'push'
uses: softprops/action-gh-release@v2
with:
generate_release_notes: true