-
Notifications
You must be signed in to change notification settings - Fork 16
83 lines (70 loc) · 2.84 KB
/
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
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
80
81
82
83
name: Release
on:
release:
types: [ published ]
jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Set version
uses: actions/github-script@v7
id: set_version
with:
script: |
const tagName = context.payload.release.tag_name
const version = tagName.replace('v', '')
core.setOutput('version', version)
- name: Set up Java
uses: actions/setup-java@v4
with:
java-version: 8
distribution: temurin
server-id: ossrh
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}
gpg-passphrase: MAVEN_GPG_PASSPHRASE
- name: Build with Apache Maven
run: ./mvnw --batch-mode package
- name: Set artifact version
run: ./mvnw --batch-mode versions:set -DnewVersion=${{ steps.set_version.outputs.version }}
- name: Publish package to Apache Maven Central
run: ./mvnw --batch-mode deploy
env:
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
outputs:
version: ${{ steps.set_version.outputs.version }}
update-version:
needs: [ publish ]
permissions:
contents: write # for peter-evans/create-pull-request to create branch
pull-requests: write # for peter-evans/create-pull-request to create a PR
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4
with:
ref: main
fetch-depth: 0
- name: Update Maven version in README.md
run: sed -i 's/<version>.*<\/version>/<version>${{ needs.publish.outputs.version }}<\/version>/g' README.md
- name: Update Gradle Groovy version in README.md
run: sed -i "s/implementation 'org.semver4j:semver4j:.*/implementation 'org.semver4j:semver4j:${{ needs.publish.outputs.version }}'/g" README.md
- name: Update Gradle Kotlin version in README.md
run: sed -i "s/implementation(\"org.semver4j:semver4j:.*/implementation(\"org.semver4j:semver4j:${{ needs.publish.outputs.version }}\")/g" README.md
- name: Show diff
run: git diff
- name: Create Pull Request
uses: peter-evans/create-pull-request@v6.1.0
with:
commit-message: Update versions after ${{ github.event.release.tag_name }} release
title: Update versions after ${{ github.event.release.tag_name }} release
body: Update versions after ${{ github.event.release.tag_name }} release
branch: update-versions-${{ github.event.release.tag_name }}
labels: |
documentation
skip-changelog