forked from DSpace/xoai
-
Notifications
You must be signed in to change notification settings - Fork 3
51 lines (48 loc) · 1.8 KB
/
maven-release.yml
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
name: Release to Maven Central Repository
on:
push:
tags:
- '*'
workflow_call:
inputs:
version:
type: string
required: true
jobs:
publish:
runs-on: ubuntu-latest
steps:
- if: ${{ github.event_name == 'push' }}
uses: actions/checkout@v4
- if: ${{ inputs.version }}
uses: actions/checkout@v4
with:
ref: "${{ inputs.version }}"
# Alternative command if we just inherit the jdk.version from the parent (grep is faster):
# $(mvn help:evaluate -Dexpression=jdk.version -q -DforceStdout)
- name: Determine Java version from POM
run: |
echo "JAVA_VERSION=$(grep '<jdk.version>' pom.xml | cut -f2 -d'>' | cut -f1 -d'<')" >> ${GITHUB_ENV}
- name: Set up JDK ${{ env.JAVA_VERSION }}
uses: actions/setup-java@v4
with:
java-version: ${{ env.JAVA_VERSION }}
distribution: 'temurin'
cache: 'maven'
# Running setup-java again overwrites the settings.xml - IT'S MANDATORY TO DO THIS SECOND SETUP!!!
- name: Set up Maven Central Repository
uses: actions/setup-java@v4
with:
java-version: ${{ env.JAVA_VERSION }}
distribution: 'temurin'
server-id: ossrh
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
gpg-private-key: ${{ secrets.DATAVERSEBOT_GPG_KEY }}
gpg-passphrase: MAVEN_GPG_PASSPHRASE
- name: Sign + Publish release
run: mvn -Prelease deploy -pl '!report,!xoai-data-provider-tck' -DskipAnalysis -DskipUT -DskipIT
env:
MAVEN_USERNAME: ${{ secrets.DATAVERSEBOT_SONATYPE_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.DATAVERSEBOT_SONATYPE_TOKEN }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.DATAVERSEBOT_GPG_PASSWORD }}