-
Notifications
You must be signed in to change notification settings - Fork 3.1k
133 lines (110 loc) · 5 KB
/
release-to-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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
name: release-to-maven-central
on:
workflow_dispatch:
inputs:
releaseversion:
description: 'Release version'
required: true
default: '3.0.0'
copyDocsToCurrent:
description: "Should the docs be published at https://docs.spring-boot-admin.com? Otherwise they will be accessible by version number only."
required: true
type: boolean
default: false
jobs:
publish-central-and-pages:
runs-on: ubuntu-latest
steps:
- run: echo "Will start a Maven Central upload with version ${{ github.event.inputs.releaseversion }}"
- uses: actions/checkout@v4
- name: Set up settings.xml for Maven Central Repository
uses: actions/setup-java@v4
with:
distribution: 'adopt'
java-version: '17'
server-id: oss.sonatype.org
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}
gpg-passphrase: MAVEN_GPG_PASSPHRASE
cache: 'maven'
- name: Cache node modules
uses: actions/cache@v3
env:
cache-name: cache-node-modules
with:
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
- name: Set projects Maven version to GitHub Action GUI set version
run: mvn versions:set "-DnewVersion=${{ github.event.inputs.releaseversion }}" --no-transfer-progress
- name: Publish package
run: mvn -B deploy --no-transfer-progress -P central-deploy -DskipTests=true
env:
#TODO: This is a workaround for NEXUS-27902 which uses XStream that fails on JVM >16
JDK_JAVA_OPTIONS: "--add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.lang.reflect=ALL-UNNAMED --add-opens java.base/java.text=ALL-UNNAMED --add-opens java.desktop/java.awt.font=ALL-UNNAMED"
MAVEN_USERNAME: ${{ secrets.OSS_SONATYPE_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSS_SONATYPE_PASSWORD }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
- name: Deploy Asciidoc docs output to GitHub Pages
uses: JamesIves/[email protected]
with:
branch: gh-pages # The branch the action should deploy to.
folder: spring-boot-admin-docs/target/generated-docs # The folder the action should deploy.
target-folder: ${{ github.event.inputs.releaseversion }}
clean: true # Automatically remove deleted files from the deploy branch
- name: Deploy Asciidoc docs output to GitHub Pages
uses: JamesIves/[email protected]
if: github.event.inputs.copyDocsToCurrent == 'true'
with:
branch: gh-pages # The branch the action should deploy to.
folder: spring-boot-admin-docs/target/generated-docs # The folder the action should deploy.
target-folder: /current
clean: true # Automatically remove deleted files from the deploy branch
publish-github-release:
needs: publish-central-and-pages
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Generate changelog
id: changelog
uses: metcalfc/[email protected]
with:
myToken: ${{ secrets.GITHUB_TOKEN }}
- name: Create GitHub Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.event.inputs.releaseversion }}
release_name: ${{ github.event.inputs.releaseversion }}
body: |
Grab the new version from Maven central https://repo1.maven.org/maven2/de/codecentric/
Current docs at https://codecentric.github.io/spring-boot-admin/${{ github.event.inputs.releaseversion }}/
### Things that changed in this release
${{ steps.changelog.outputs.changelog }}
draft: false
prerelease: ${{ contains(github.event.inputs.releaseversion, '-') }}
set-next-snapshot-version:
needs: publish-github-release
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: Set new SNAPSHOT version
run: >
mvn versions:set "-DnewVersion=${{ github.event.inputs.releaseversion }}" && \
mvn versions:set -DnextSnapshot && \
VERSION=$(mvn exec:exec -Dexec.executable='echo' -Dexec.args='${project.version}' --non-recursive -q) && \
mvn versions:revert && \
mvn versions:set-property -Dproperty=revision -DnewVersion="$VERSION" &&
mvn versions:commit
- name: Commit new SNAPSHOT version
uses: stefanzweifel/git-auto-commit-action@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
commit_message: "chore: update to next SNAPSHOT version"