-
Notifications
You must be signed in to change notification settings - Fork 4
58 lines (57 loc) · 2.36 KB
/
Copy pathbuild_deploy.yml
File metadata and controls
58 lines (57 loc) · 2.36 KB
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
name: Publish package to the Maven Central Repository
on:
push:
branches:
- master
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Maven Central Repository
uses: actions/setup-java@v4
with:
java-version: '11'
distribution: 'temurin'
server-id: ossrh
server-username: MAVEN_USERNAME
server-password: MAVEN_CENTRAL_TOKEN
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
gpg-passphrase: secrets.GPG_PASSPHRASE
- name: Set versions for release
run: mvn versions:set -DremoveSnapshot -DgenerateBackupPoms=false
- name: Publish to Apache Maven Central
run: mvn deploy
env:
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
MAVEN_CENTRAL_TOKEN: ${{ secrets.MAVEN_CENTRAL_TOKEN }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
- name: Grab release version
run: echo "::set-output name=MVNVERSION::$(mvn -Dexec.executable='echo' -Dexec.args='${project.version}' --non-recursive exec:exec -q)"
id: releaseversion
- name: Print Release Version
run: "echo 'Release Version: ${{steps.releaseversion.outputs.MVNVERSION}}'"
- name: Tag Release
uses: thejeff77/action-push-tag@v1.0.0
with:
tag: ${{ steps.releaseversion.outputs.MVNVERSION }}
- name: Bump Versions and add SNAPSHOT
id: bump
run: mvn --batch-mode release:update-versions
- name: Grab new version
run: echo "::set-output name=MVNVERSION::$(mvn -Dexec.executable='echo' -Dexec.args='${project.version}' --non-recursive exec:exec -q)"
id: mvnversion
- name: Print Version
run: "echo 'New Version: ${{steps.mvnversion.outputs.MVNVERSION}}'"
- name: Find and Replace ReadMe versions
uses: jacobtomlinson/gha-find-replace@master
with:
find: "<version>.*</version>"
replace: "<version>${{steps.releaseversion.outputs.MVNVERSION}}</version>"
include: "README.md"
- name: Commit & Push changes
uses: actions-js/push@master
with:
branch: master
github_token: ${{ secrets.GITHUB_TOKEN }}
message: "Updating maven dev version: ${{steps.mvnversion.outputs.MVNVERSION}}, and updating ReadMe files with latest released version."