Skip to content
This repository was archived by the owner on Sep 20, 2024. It is now read-only.

Commit f4879e2

Browse files
authored
Create gradle-publish-central.yml
1 parent 10f9da6 commit f4879e2

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# This workflow will build a package using Gradle and then publish it to GitHub packages when a release is created
2+
# For more information see: https://github.com/actions/setup-java/blob/main/docs/advanced-usage.md#Publishing-using-gradle
3+
4+
name: Publish to Maven Central
5+
6+
on:
7+
release:
8+
types: [created]
9+
10+
jobs:
11+
build:
12+
13+
runs-on: ubuntu-latest
14+
permissions:
15+
contents: read
16+
packages: write
17+
18+
steps:
19+
- uses: actions/checkout@v2
20+
- name: Set up JDK 11
21+
uses: actions/setup-java@v2
22+
with:
23+
java-version: '11'
24+
distribution: 'adopt'
25+
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
26+
settings-path: ${{ github.workspace }} # location for the settings.xml file
27+
28+
- name: Build with Gradle
29+
run: gradle build
30+
31+
- name: Copy key to tmp file
32+
run: 'base64 -d "$PRIV_KEY64" > ./key'
33+
shell: bash
34+
env:
35+
PRIV_KEY64: ${{ secrets.PRIV_KEY64 }}
36+
37+
# The USERNAME and TOKEN need to correspond to the credentials environment variables used in
38+
# the publishing section of your build.gradle
39+
- name: Publish to GitHub Packages
40+
run: gradle publishAllPublicationsToSonatypeRepository
41+
env:
42+
SIGNING_KEY_ID: ${{ secrets.KEY_ID }}
43+
SIGNING_PASSWORD: ${{ secrets.PASSWORD }}
44+
SIGNING_SECRET_KEY_RING_FILE: './key'
45+
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
46+
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}

0 commit comments

Comments
 (0)