forked from DSpace/xoai
-
Notifications
You must be signed in to change notification settings - Fork 3
53 lines (49 loc) · 1.89 KB
/
maven-release-manual.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
52
53
name: Trigger release to Maven Central Repository
on:
workflow_dispatch:
inputs:
version:
description: "The version to set for this release"
required: true
type: string
jobs:
trigger:
runs-on: ubuntu-latest
permissions:
# We need write permission so we can push the next snapshot version
contents: write
steps:
- uses: actions/checkout@v4
- run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
# 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'
- name: Update version in pom.xml and tag
run: |
mvn -B versions:set -DnewVersion="${{ inputs.version }}" -DgenerateBackupPoms=false
git add pom.xml
git commit -m "[github-action] Release version ${{ inputs.version }}"
git tag "${{ inputs.version }}"
- name: Increment to next version, commit and push
run: |
mvn -B versions:set -DnextSnapshot -DnextSnapshotIndexToIncrement=2 -DgenerateBackupPoms=false
git add pom.xml
git commit -m "[github-action] Increment version after release of ${{ inputs.version }}"
git push --tags origin main
release:
name: Run release workflow
uses: ./.github/workflows/maven-release.yml
needs: [trigger]
secrets: inherit
with:
version: "${{ inputs.version }}"