1
+ name : release-to-maven-central
2
+ on :
3
+ workflow_dispatch :
4
+ inputs :
5
+ releaseversion :
6
+ description : ' Release version'
7
+ required : true
8
+ default : ' 2.0.0'
9
+ jobs :
10
+ publish :
11
+ runs-on : ubuntu-latest
12
+ steps :
13
+ - run : echo "Will start a Maven Central upload with version ${{ github.event.inputs.releaseversion }}"
14
+
15
+ - uses : actions/checkout@v2
16
+
17
+ - name : Set up settings.xml for Maven Central Repository
18
+ uses : actions/setup-java@v1
19
+ with :
20
+ java-version : 11
21
+ server-id : oss.sonatype.org
22
+ server-username : MAVEN_USERNAME
23
+ server-password : MAVEN_PASSWORD
24
+ gpg-private-key : ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}
25
+ gpg-passphrase : MAVEN_GPG_PASSPHRASE
26
+
27
+ - name : Set projects Maven version to GitHub Action GUI set version
28
+ run : mvn versions:set "-DnewVersion=${{ github.event.inputs.releaseversion }}" --no-transfer-progress
29
+
30
+ - name : Publish package
31
+ run : mvn --batch-mode clean deploy --no-transfer-progress -P central-deploy -DskipTests=true
32
+ env :
33
+ MAVEN_USERNAME : ${{ secrets.OSS_SONATYPE_USERNAME }}
34
+ MAVEN_PASSWORD : ${{ secrets.OSS_SONATYPE_PASSWORD }}
35
+ MAVEN_GPG_PASSPHRASE : ${{ secrets.MAVEN_GPG_PASSPHRASE }}
36
+
37
+ - name : Generate changelog
38
+ id : changelog
39
+
40
+ with :
41
+ myToken : ${{ secrets.GITHUB_TOKEN }}
42
+
43
+ - name : Create GitHub Release
44
+ id : create_release
45
+ uses : actions/create-release@v1
46
+ env :
47
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
48
+ with :
49
+ tag_name : ${{ github.event.inputs.releaseversion }}
50
+ release_name : ${{ github.event.inputs.releaseversion }}
51
+ body : |
52
+ Grab the new version from Maven central https://repo1.maven.org/maven2/de/codecentric/reedelk/module-file/${{ github.event.inputs.releaseversion }}/
53
+ ### Things that changed in this release
54
+ ${{ steps.changelog.outputs.changelog }}
55
+ draft : false
56
+ prerelease : false
0 commit comments