Skip to content

Commit a9b9da2

Browse files
committed
Release update
1 parent 0e3d1ee commit a9b9da2

File tree

3 files changed

+113
-128
lines changed

3 files changed

+113
-128
lines changed

.github/workflows/release.yml

Lines changed: 67 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -9,57 +9,89 @@
99
name: Release
1010

1111
on:
12-
push:
13-
tags:
14-
- v*
12+
workflow_dispatch:
13+
inputs:
14+
version:
15+
description: 'Release version'
16+
required: true
17+
next:
18+
description: 'Next version'
19+
required: false
20+
21+
env:
22+
JAVA_VERSION: '11'
23+
JAVA_DISTRO: 'temurin'
1524

1625
jobs:
1726
release:
18-
name: Release
1927
runs-on: ubuntu-latest
20-
2128
steps:
22-
- name: Version
23-
id: version
24-
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\/v/}
25-
26-
- name: Checkout
27-
uses: actions/checkout@v4
29+
- uses: actions/checkout@v4
2830
with:
2931
fetch-depth: 0
3032

31-
- name: Cache Maven
32-
uses: actions/cache@v4
33-
with:
34-
path: ~/.m2/repository
35-
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
36-
restore-keys: ${{ runner.os }}-m2
37-
3833
- name: Setup Java
3934
uses: actions/setup-java@v4
4035
with:
41-
java-version: 11
42-
distribution: 'temurin'
43-
server-id: central
44-
server-username: MAVEN_USERNAME
45-
server-password: MAVEN_CENTRAL_TOKEN
46-
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
47-
gpg-passphrase: MAVEN_GPG_PASSPHRASE
36+
java-version: ${{ env.JAVA_VERSION }}
37+
distribution: ${{ env.JAVA_DISTRO }}
38+
cache: maven
4839

49-
- name: Release
50-
env:
51-
MAVEN_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
52-
MAVEN_CENTRAL_TOKEN: ${{ secrets.SONATYPE_PASSWORD }}
53-
MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
40+
- name: Set release version
41+
id: version
42+
run: |
43+
BRANCH="oss-quickstart-${{ github.event.inputs.version }}"
44+
RELEASE_VERSION=${{ github.event.inputs.version }}
45+
NEXT_VERSION=${{ github.event.inputs.next }}
46+
PLAIN_VERSION=`echo ${RELEASE_VERSION} | awk 'match($0, /^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)/) { print substr($0, RSTART, RLENGTH); }'`
47+
COMPUTED_NEXT_VERSION="${PLAIN_VERSION}-SNAPSHOT"
48+
if [ -z $NEXT_VERSION ]
49+
then
50+
NEXT_VERSION=$COMPUTED_NEXT_VERSION
51+
fi
52+
git checkout -b $BRANCH
53+
./mvnw -ntp -B versions:set versions:commit -DnewVersion=$RELEASE_VERSION
54+
git config --global user.email "[email protected]"
55+
git config --global user.name "moditect-release-bot"
56+
git commit -a -m "Releasing version $RELEASE_VERSION"
57+
git push origin $BRANCH
58+
echo "BRANCH=$BRANCH" >> $GITHUB_ENV
59+
echo "RELEASE_VERSION=$RELEASE_VERSION" >> $GITHUB_ENV
60+
echo "NEXT_VERSION=$NEXT_VERSION" >> $GITHUB_ENV
61+
echo "PLAIN_VERSION=$PLAIN_VERSION" >> $GITHUB_ENV
62+
63+
- name: Stage
5464
run: |
5565
export GPG_TTY=$(tty)
56-
export MAVEN_OPTS=--illegal-access=permit
57-
mvn --no-transfer-progress -B --file pom.xml \
66+
./mvnw -ntp -B --file pom.xml \
5867
-Drepository.url=https://${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git \
59-
-Dmaven.site.skip=true -Drelease=true deploy
68+
-Dmaven.site.skip=true -Drelease=true -Ppublication,stage
6069
61-
- name: Release to GitHub
70+
- name: Release
6271
env:
6372
JRELEASER_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
73+
JRELEASER_BRANCH: ${{ env.BRANCH }}
74+
JRELEASER_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
75+
JRELEASER_GPG_PUBLIC_KEY: ${{ secrets.GPG_PUBLIC_KEY }}
76+
JRELEASER_GPG_SECRET_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
77+
JRELEASER_NEXUS2_MAVEN_CENTRAL_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
78+
JRELEASER_NEXUS2_MAVEN_CENTRAL_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
79+
run: |
80+
./mvnw -ntp -B --file pom.xml -Pjreleaser jreleaser:release
81+
82+
- name: JReleaser output
83+
if: always()
84+
uses: actions/upload-artifact@v4
85+
with:
86+
name: jreleaser-release
87+
path: |
88+
parent/target/jreleaser/trace.log
89+
parent/target/jreleaser/output.properties
90+
91+
- name: Set next version
6492
run: |
65-
mvn -B --file pom.xml -pl :ossquickstart-aggregator -Pjreleaser jreleaser:release
93+
./mvnw -ntp -B versions:set versions:commit -DnewVersion=${{ env.NEXT_VERSION }}
94+
git config --global user.email "[email protected]"
95+
git config --global user.name "moditect-release-bot"
96+
git commit -a -m "Next version ${{ env.NEXT_VERSION }}"
97+
git push origin ${{ env.BRANCH }}

.github/workflows/trigger.yml

Lines changed: 0 additions & 85 deletions
This file was deleted.

pom.xml

Lines changed: 46 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,15 @@
161161
</modules>
162162

163163
<profiles>
164+
<profile>
165+
<id>stage</id>
166+
<properties>
167+
<altDeploymentRepository>local::file:${maven.multiModuleProjectDirectory}/target/staging-deploy</altDeploymentRepository>
168+
</properties>
169+
<build>
170+
<defaultGoal>deploy</defaultGoal>
171+
</build>
172+
</profile>
164173
<profile>
165174
<id>jreleaser</id>
166175
<build>
@@ -171,22 +180,51 @@
171180
<version>1.10.0</version>
172181
<inherited>false</inherited>
173182
<configuration>
183+
<gitRootSearch>true</gitRootSearch>
174184
<jreleaser>
185+
<project>
186+
<name>oss-quickstart</name>
187+
<links>
188+
<homepage>https://github.com/moditect/oss-quickstart</homepage>
189+
<documentation>https://github.com/moditect/oss-quickstart</documentation>
190+
</links>
191+
</project>
192+
<signing>
193+
<active>ALWAYS</active>
194+
<armored>true</armored>
195+
</signing>
196+
<deploy>
197+
<maven>
198+
<nexus2>
199+
<maven-central>
200+
<active>ALWAYS</active>
201+
<url>https://oss.sonatype.org/service/local</url>
202+
<snapshotUrl>https://oss.sonatype.org/content/repositories/snapshots/</snapshotUrl>
203+
<closeRepository>true</closeRepository>
204+
<releaseRepository>true</releaseRepository>
205+
<stagingRepositories>${maven.multiModuleProjectDirectory}/target/staging-deploy</stagingRepositories>
206+
</maven-central>
207+
</nexus2>
208+
</maven>
209+
</deploy>
175210
<release>
176211
<github>
177-
<skipTag>true</skipTag>
212+
<tagName>{{projectVersion}}</tagName>
213+
<releaseName>{{projectVersion}}</releaseName>
214+
<overwrite>true</overwrite>
215+
<issues>
216+
<enabled>true</enabled>
217+
</issues>
178218
<changelog>
179219
<formatted>ALWAYS</formatted>
180-
<preset>gitmoji</preset>
181-
<format>- {{commitShortHash}} {{commitTitle}}</format>
220+
<formatted>ALWAYS</formatted>
221+
<preset>conventional-commits</preset>
222+
<skipMergeCommits>true</skipMergeCommits>
182223
<contributors>
183-
<format>* {{contributorName}}{{#contributorUsernameAsLink}} ({{.}}){{/contributorUsernameAsLink}}</format>
224+
<format>- {{contributorName}}{{#contributorUsernameAsLink}} ({{.}}){{/contributorUsernameAsLink}}</format>
184225
</contributors>
185226
<hide>
186-
<contributors>
187-
<contributor>GitHub</contributor>
188-
<contributor>bot</contributor>
189-
</contributors>
227+
<contributors>GitHub,dependabot</contributors>
190228
</hide>
191229
</changelog>
192230
</github>

0 commit comments

Comments
 (0)