-
Notifications
You must be signed in to change notification settings - Fork 10
36 lines (32 loc) · 1.15 KB
/
release.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
name: Publish package to MavenCentral
on:
release:
types: [ created ]
workflow_dispatch:
jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
- name: Set version
id: version
run: |
DATE=$(date +'%Y%m%d')
HASH=$(git rev-parse --short HEAD)
echo "VERSION=${DATE}-${HASH}" >> $GITHUB_ENV
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
- name: Configure GPG Key
run: |
echo -n "${{ secrets.GPG_SIGNING_KEY }}" | base64 --decode > $HOME/secring.gpg
- name: Publish package
run: ./gradlew publish -Pversion=$VERSION -Psigning.secretKeyRingFile="$HOME/secring.gpg" -Psigning.password="${{ secrets.GPG_SIGNING_KEY_PASSWORD }}" -Psigning.keyId="${{ secrets.GPG_SIGNING_KEY_ID }}" -PsonatypeUsername="${{ secrets.SONATYPE_USERNAME }}" -PsonatypePassword="${{ secrets.SONATYPE_PASSWORD }}"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}