Skip to content

Commit 876f801

Browse files
committed
release: migrate to sonatype central
1 parent 1f490ee commit 876f801

File tree

5 files changed

+109
-121
lines changed

5 files changed

+109
-121
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: scylla-3.x
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 != 'scylla-3.x'
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 == 'scylla-3.x' }}
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: 20 additions & 32 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>
@@ -638,14 +640,12 @@
638640
<configuration>
639641
<tagNameFormat>@{project.version}</tagNameFormat>
640642
<autoVersionSubmodules>true</autoVersionSubmodules>
641-
<!-- useReleaseProfile>false</useReleaseProfile>
642643
<releaseProfiles>release</releaseProfiles>
643-
<goals>deploy</goals-->
644+
<useReleaseProfile>false</useReleaseProfile>
644645
<localCheckout>true</localCheckout>
645-
<deployAtEnd>true</deployAtEnd>
646646
<pushChanges>${pushChanges}</pushChanges>
647647
<mavenExecutorId>forked-path</mavenExecutorId>
648-
<arguments>-Dgpg.passphrase=${gpg.passphrase}</arguments>
648+
<arguments>-Dgpg.passphrase=${gpg.passphrase} -Drelease.autopublish=${release.autopublish}</arguments>
649649
</configuration>
650650
<dependencies>
651651
<dependency>
@@ -839,18 +839,6 @@
839839
</executions>
840840
</plugin>
841841

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-
854842
<plugin>
855843
<groupId>org.ops4j</groupId>
856844
<artifactId>maven-pax-plugin</artifactId>
@@ -903,7 +891,18 @@
903891
</execution>
904892
</executions>
905893
</plugin>
906-
894+
<plugin>
895+
<groupId>org.sonatype.central</groupId>
896+
<artifactId>central-publishing-maven-plugin</artifactId>
897+
<version>0.8.0</version>
898+
<extensions>true</extensions>
899+
<configuration>
900+
<publishingServerId>central</publishingServerId>
901+
<excludeArtifacts>scylla-driver-tests-parent,scylla-driver-tests-osgi,scylla-driver-tests-osgi-common,scylla-driver-tests-osgi-shaded,scylla-driver-tests-shading,scylla-driver-tests-shading-shaded,scylla-driver-tests-shading-unshaded,scylla-driver-tests-osgi-unshaded,scylla-driver-tests-stress,scylla-driver-dist,scylla-driver-examples</excludeArtifacts>
902+
<autoPublish>${release.autopublish}</autoPublish>
903+
<waitUntil>validated</waitUntil>
904+
</configuration>
905+
</plugin>
907906
</plugins>
908907

909908
</build>
@@ -1054,17 +1053,6 @@
10541053
</execution>
10551054
</executions>
10561055
</plugin>
1057-
<plugin>
1058-
<groupId>org.sonatype.plugins</groupId>
1059-
<artifactId>nexus-staging-maven-plugin</artifactId>
1060-
<extensions>true</extensions>
1061-
<configuration>
1062-
<serverId>ossrh</serverId>
1063-
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
1064-
<autoReleaseAfterClose>true</autoReleaseAfterClose>
1065-
<!-- skipLocalStaging>true</skipLocalStaging -->
1066-
</configuration>
1067-
</plugin>
10681056
</plugins>
10691057
</build>
10701058
</profile>
@@ -1130,12 +1118,12 @@
11301118

11311119
<distributionManagement>
11321120
<snapshotRepository>
1133-
<id>ossrh</id>
1134-
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
1121+
<id>central</id>
1122+
<url>https://central.sonatype.com/repository/maven-snapshots</url>
11351123
</snapshotRepository>
11361124
<repository>
1137-
<id>ossrh</id>
1138-
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
1125+
<id>central</id>
1126+
<url>https://central.sonatype.com/repository/maven-releases</url>
11391127
</repository>
11401128
</distributionManagement>
11411129

0 commit comments

Comments
 (0)