-
Notifications
You must be signed in to change notification settings - Fork 4
61 lines (55 loc) · 1.86 KB
/
release-maven-central.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
54
55
56
57
58
59
60
61
name: Publish package to Maven Central
on:
pull_request:
branches:
- master
types: [closed]
jobs:
publish:
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
steps:
- name: Step 1 - Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Step 2 - Set up Maven Central Repository
uses: actions/setup-java@v3
with:
java-version: "11"
distribution: "adopt"
server-id: ossrh
server-username: MVN_CENTRAL_USERNAME
server-password: MVN_CENTRAL_PASSWORD
gpg-private-key: ${{ secrets.GPG_SECRET_KEY }}
gpg-passphrase: MVN_GPG_PASSPHRASE
- name: Step 3 - Install GitVersion
uses: gittools/actions/gitversion/setup@v0
with:
versionSpec: '5.x'
- name: Step 4 - Determine Version
id: gitversion
uses: gittools/actions/gitversion/execute@v0
with:
useConfigFile: true
- name: Step 5 - Create Release
id: create_release
uses: actions/create-release@latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TITLE: ${{ github.event.pull_request.title }}
BODY: ${{ github.event.pull_request.body }}
VERSION: "v${{ steps.gitversion.outputs.semVer }}"
with:
tag_name: ${{ env.VERSION }}
release_name: ${{ env.VERSION }} ${{ env.TITLE }}
body: ${{ env.BODY }}
draft: false
prerelease: false
- name: Step 6 - Publish package
run: |
mvn -Dmaven.test.skip=true -P release -Drevision=${{ steps.gitversion.outputs.semVer }} deploy
env:
MVN_CENTRAL_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MVN_CENTRAL_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
MVN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}