-
Notifications
You must be signed in to change notification settings - Fork 1
80 lines (78 loc) · 2.98 KB
/
publish_ossrh.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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
name: Pushlish Java Client to OSSRH
on:
workflow_dispatch:
push:
tags:
- "v*.*.*"
jobs:
test-with-coverage:
name: Publish package
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v3
with:
fetch-depth: 1
ref: ${{ github.ref_name }}
- name: Generate release changelog
id: generate_changelog
uses: mikepenz/[email protected]
with:
configuration: ".github/configuration.json"
- name: Modify version
id: version
run: |
VERSION=${{ steps.generate_changelog.outputs.toTag}}
echo "version=${VERSION:1}" >> $GITHUB_OUTPUT
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
distribution: 'zulu' # See 'Supported distributions' for available options
java-version: '11'
server-id: ossrh
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} # Value of the GPG private key to import
gpg-passphrase: MAVEN_GPG_PASSPHRASE # env variable for GPG private key pcassphrase
- name: Modify pom version
run: |
mvn versions:set -DnewVersion=${{ steps.version.outputs.version }}
- name: Publish package
run: mvn --batch-mode clean deploy -Dmaven.exec.skip=true
if: github.event_name != 'workflow_dispatch'
env:
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
- name: Create release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ steps.generate_changelog.outputs.toTag }}
release_name: ${{ steps.generate_changelog.outputs.toTag }}
body: "${{ steps.generate_changelog.outputs.changelog }}"
- name: Checkout main
run: |
git fetch origin main
git checkout main
mvn versions:set -DnewVersion=${{ steps.version.outputs.version }}
- name: Create changelog pull request
id: cpr
uses: peter-evans/create-pull-request@v5
with:
commit-message: "[chore]: modify version(${{ steps.generate_changelog.outputs.toTag }})"
branch: versions
signoff: true
delete-branch: true
title: "[chore]: modify version(${{ steps.generate_changelog.outputs.toTag }})"
body: |
Modify pom.xml version
- Auto-generated by [create-pull-request][1]
[1]: https://github.com/peter-evans/create-pull-request
labels: |
release_bot
- name: Auto merge pull request
if: steps.cpr.outputs.pull-request-operation == 'created'
uses: peter-evans/enable-pull-request-automerge@v3
with:
pull-request-number: ${{ steps.cpr.outputs.pull-request-number }}
merge-method: rebase