Skip to content

Commit 1e9c4b6

Browse files
committed
release: migrate to sonatype central
1 parent ad4ff1c commit 1e9c4b6

File tree

5 files changed

+102
-112
lines changed

5 files changed

+102
-112
lines changed

.github/workflows/release.yml

Lines changed: 89 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,20 @@ name: Release ScyllaDB Java Driver
33
on:
44
workflow_dispatch:
55
inputs:
6-
dryrun:
6+
dry-run:
77
type: boolean
8-
description: 'dryrun: run without pushing SCM changes to upstream'
9-
default: true
8+
description: 'dry-run: run without pushing SCM changes to upstream'
9+
default: false
10+
11+
skip-tests:
12+
type: boolean
13+
description: 'skip-tests: do not run tests while releasing'
14+
default: false
15+
16+
target-tag:
17+
type: string
18+
description: 'target-tag: tag or branch name to release. Use to to re-release failed releases'
19+
default: master
1020

1121
jobs:
1222
release:
@@ -20,44 +30,79 @@ jobs:
2030
MVNCMD: mvn -B -X -ntp
2131

2232
steps:
23-
- name: Checkout Repository
24-
uses: actions/checkout@v4
25-
26-
- name: Set up Java
27-
uses: actions/setup-java@v4
28-
with:
29-
java-version: '8'
30-
distribution: 'temurin'
31-
server-id: ossrh
32-
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
33-
server-username: OSSRH_USERNAME
34-
server-password: OSSRH_PASSWORD
35-
36-
- name: Configure Git user
37-
run: |
38-
git config user.name "ScyllaDB Promoter"
39-
git config user.email "[email protected]"
40-
41-
- name: Clean project
42-
run: $MVNCMD clean
43-
44-
- name: Clean release
45-
run: $MVNCMD release:clean
46-
47-
- name: Prepare release
48-
env:
49-
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
50-
run: $MVNCMD release:prepare -DpushChanges=false -Dgpg.passphrase=${{ secrets.GPG_PASSPHRASE }}
51-
52-
- name: Perform release
53-
env:
54-
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
55-
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
56-
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
57-
run: $MVNCMD release:perform -Dgpg.passphrase=${{ secrets.GPG_PASSPHRASE }}
58-
59-
- name: Push changes to SCM
60-
if: ${{ github.event.inputs.dryrun == 'false' }}
61-
run: |
62-
git status && git log -3
63-
git push origin --follow-tags -v
33+
- name: Checkout Repository
34+
uses: actions/checkout@v4
35+
36+
- name: Checkout Code One Commit Before ${{ inputs.target-tag }}
37+
if: inputs.target-tag != 'master'
38+
run: |
39+
git fetch --prune --unshallow || true
40+
git checkout ${{ inputs.target-tag }}~1
41+
git tag -d ${{ inputs.target-tag }}
42+
43+
- name: Set up Java
44+
uses: actions/setup-java@v4
45+
with:
46+
java-version: '11'
47+
distribution: 'temurin'
48+
server-id: central
49+
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
50+
server-username: SONATYPE_TOKEN_USERNAME
51+
server-password: SONATYPE_TOKEN_PASSWORD
52+
53+
- name: Configure Git user
54+
run: |
55+
git config user.name "ScyllaDB Promoter"
56+
git config user.email "[email protected]"
57+
58+
- name: Clean project
59+
run: $MVNCMD clean
60+
61+
- name: Clean release
62+
run: $MVNCMD release:clean
63+
64+
- name: Prepare release
65+
env:
66+
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
67+
run: |
68+
if [[ "${{ inputs.skip-tests }}" == "true" ]]; then
69+
MAVEN_OPTS="${MAVEN_OPTS} -DskipTests=true -DskipITs=true"
70+
fi
71+
export MAVEN_OPTS
72+
$MVNCMD release:prepare -DpushChanges=false -Dgpg.passphrase=${{ secrets.GPG_PASSPHRASE }}
73+
74+
- name: Perform release
75+
env:
76+
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
77+
SONATYPE_TOKEN_USERNAME: ${{ secrets.SONATYPE_TOKEN_USERNAME }}
78+
SONATYPE_TOKEN_PASSWORD: ${{ secrets.SONATYPE_TOKEN_PASSWORD }}
79+
run: |
80+
CMD_OPTS=""
81+
if [[ "${{ inputs.dry-run }}" != "true" ]]; then
82+
CMD_OPTS="-Drelease.autopublish=true"
83+
fi
84+
if [[ "${{ inputs.skip-tests }}" == "true" ]]; then
85+
MAVEN_OPTS="${MAVEN_OPTS} -DskipTests=true -DskipITs=true"
86+
fi
87+
export MAVEN_OPTS
88+
$MVNCMD release:perform $CMD_OPTS -Dgpg.passphrase=${{ secrets.GPG_PASSPHRASE }} > >(tee /tmp/logs-stdout.log) 2> >(tee /tmp/logs-stderr.log)
89+
90+
- name: Upload stdout.log
91+
if: failure()
92+
uses: actions/upload-artifact@v4
93+
with:
94+
name: maven-stdout
95+
path: /tmp/logs-stdout.log
96+
97+
- name: Upload stderr.log
98+
if: failure()
99+
uses: actions/upload-artifact@v4
100+
with:
101+
name: maven-stderr
102+
path: /tmp/logs-stderr.log
103+
104+
- name: Push changes to SCM
105+
if: ${{ inputs.dry-run == 'false' && inputs.target-tag == 'master' }}
106+
run: |
107+
git status && git log -3
108+
git push origin --follow-tags -v

driver-dist/pom.xml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -144,13 +144,6 @@
144144
<tarLongFileMode>posix</tarLongFileMode>
145145
</configuration>
146146
</plugin>
147-
<plugin>
148-
<groupId>org.sonatype.plugins</groupId>
149-
<artifactId>nexus-staging-maven-plugin</artifactId>
150-
<configuration>
151-
<skipNexusStagingDeployMojo>true</skipNexusStagingDeployMojo>
152-
</configuration>
153-
</plugin>
154147
</plugins>
155148
</build>
156149
</profile>

driver-examples/pom.xml

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -188,23 +188,4 @@
188188

189189
</build>
190190

191-
<profiles>
192-
193-
<profile>
194-
<id>release</id>
195-
<build>
196-
<plugins>
197-
<plugin>
198-
<groupId>org.sonatype.plugins</groupId>
199-
<artifactId>nexus-staging-maven-plugin</artifactId>
200-
<configuration>
201-
<skipNexusStagingDeployMojo>true</skipNexusStagingDeployMojo>
202-
</configuration>
203-
</plugin>
204-
</plugins>
205-
</build>
206-
</profile>
207-
208-
</profiles>
209-
210191
</project>

driver-tests/pom.xml

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -91,23 +91,4 @@
9191

9292
</build>
9393

94-
<profiles>
95-
96-
<profile>
97-
<id>release</id>
98-
<build>
99-
<plugins>
100-
<plugin>
101-
<groupId>org.sonatype.plugins</groupId>
102-
<artifactId>nexus-staging-maven-plugin</artifactId>
103-
<configuration>
104-
<skipNexusStagingDeployMojo>true</skipNexusStagingDeployMojo>
105-
</configuration>
106-
</plugin>
107-
</plugins>
108-
</build>
109-
</profile>
110-
111-
</profiles>
112-
11394
</project>

pom.xml

Lines changed: 13 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,8 @@
102102
regular netty-tcnative.
103103
<os.detection.classifierWithLikes>fedora</os.detection.classifierWithLikes>
104104
-->
105+
<gpg.passphrase/>
106+
<release.autopublish>false</release.autopublish>
105107
</properties>
106108

107109
<dependencyManagement>
@@ -645,7 +647,7 @@
645647
<deployAtEnd>true</deployAtEnd>
646648
<pushChanges>${pushChanges}</pushChanges>
647649
<mavenExecutorId>forked-path</mavenExecutorId>
648-
<arguments>-Dgpg.passphrase=${gpg.passphrase}</arguments>
650+
<arguments>-Dgpg.passphrase=${gpg.passphrase} -Drelease.autopublish=${release.autopublish}</arguments>
649651
</configuration>
650652
<dependencies>
651653
<dependency>
@@ -839,18 +841,6 @@
839841
</executions>
840842
</plugin>
841843

842-
<plugin>
843-
<groupId>org.sonatype.plugins</groupId>
844-
<artifactId>nexus-staging-maven-plugin</artifactId>
845-
<version>1.6.8</version>
846-
<extensions>true</extensions>
847-
<configuration>
848-
<serverId>ossrh</serverId>
849-
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
850-
<autoReleaseAfterClose>true</autoReleaseAfterClose>
851-
</configuration>
852-
</plugin>
853-
854844
<plugin>
855845
<groupId>org.ops4j</groupId>
856846
<artifactId>maven-pax-plugin</artifactId>
@@ -1055,14 +1045,14 @@
10551045
</executions>
10561046
</plugin>
10571047
<plugin>
1058-
<groupId>org.sonatype.plugins</groupId>
1059-
<artifactId>nexus-staging-maven-plugin</artifactId>
1048+
<groupId>org.sonatype.central</groupId>
1049+
<artifactId>central-publishing-maven-plugin</artifactId>
10601050
<extensions>true</extensions>
10611051
<configuration>
1062-
<serverId>ossrh</serverId>
1063-
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
1064-
<autoReleaseAfterClose>true</autoReleaseAfterClose>
1065-
<!-- skipLocalStaging>true</skipLocalStaging -->
1052+
<publishingServerId>central</publishingServerId>
1053+
<excludeArtifacts>scylla-driver-tests-parent,scylla-driver-dist,scylla-driver-examples</excludeArtifacts>
1054+
<autoPublish>${release.autopublish}</autoPublish>
1055+
<waitUntil>validated</waitUntil>
10661056
</configuration>
10671057
</plugin>
10681058
</plugins>
@@ -1130,12 +1120,12 @@
11301120

11311121
<distributionManagement>
11321122
<snapshotRepository>
1133-
<id>ossrh</id>
1134-
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
1123+
<id>central</id>
1124+
<url>https://central.sonatype.com/repository/maven-snapshots</url>
11351125
</snapshotRepository>
11361126
<repository>
1137-
<id>ossrh</id>
1138-
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
1127+
<id>central</id>
1128+
<url>https://central.sonatype.com/repository/maven-releases</url>
11391129
</repository>
11401130
</distributionManagement>
11411131

0 commit comments

Comments
 (0)