Skip to content

Commit 8009838

Browse files
committed
cicd: update release proccess
1. Update plugin to `central-publishing-maven-plugin`, old one is not working anymore 2. Drop `GPG_PASSPHRASE` in favor of `MAVEN_GPG_PASSPHRASE` 3. Make it possible for release workflow to re-release and drop re-release workflow
1 parent b088d67 commit 8009838

File tree

11 files changed

+111
-177
lines changed

11 files changed

+111
-177
lines changed

.github/workflows/re-release.yml

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

.github/workflows/release.yml

Lines changed: 66 additions & 45 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 publishing the package'
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 re-release tagged releases'
19+
default: scylla-4.x
1020

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

2232
steps:
23-
- name: Checkout Repository
24-
uses: actions/checkout@v5
33+
- name: Checkout Repository
34+
uses: actions/checkout@v4
2535

26-
- name: Set up Java
27-
uses: actions/setup-java@v5
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
36+
- name: Checkout Code One Commit Before ${{ inputs.version_tag }}
37+
if: inputs.target-tag != 'scylla-4.x'
38+
env:
39+
RELEASE_TARGET_TAG: ${{ inputs.version_tag }}
40+
run: make checkout-one-commit-before
3541

36-
- name: Configure Git user
37-
run: |
38-
git config user.name "ScyllaDB Promoter"
39-
git config user.email "github-promoter@scylladb.com"
42+
- name: Set up Java
43+
uses: actions/setup-java@v5
44+
with:
45+
java-version: '11'
46+
distribution: 'temurin'
47+
server-id: central
48+
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
49+
server-username: SONATYPE_TOKEN_USERNAME
50+
server-password: SONATYPE_TOKEN_PASSWORD
51+
cache: maven
4052

41-
- name: Clean project
42-
run: $MVNCMD clean
53+
- name: Configure Git user
54+
run: |
55+
git config user.name "ScyllaDB Promoter"
56+
git config user.email "github-promoter@scylladb.com"
4357
44-
- name: Clean release
45-
run: $MVNCMD release:clean
58+
- name: Prepare release
59+
env:
60+
MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
61+
RELEASE_SKIP_TESTS: ${{ inputs.skip-tests }}
62+
run: make release-prepare
4663

47-
- name: Prepare release
48-
env:
49-
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
50-
run: make release-prepare
64+
- name: Perform release
65+
if: inputs.dry-run == false
66+
env:
67+
RELEASE_SKIP_TESTS: ${{ inputs.skip-tests }}
68+
MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
69+
SONATYPE_TOKEN_USERNAME: ${{ secrets.SONATYPE_TOKEN_USERNAME }}
70+
SONATYPE_TOKEN_PASSWORD: ${{ secrets.SONATYPE_TOKEN_PASSWORD }}
71+
run: make release
5172

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-
if: ${{ github.event.inputs.dryrun == false }}
58-
run: make release
73+
- name: Perform release dry-run
74+
if: inputs.dry-run == true
75+
env:
76+
RELEASE_SKIP_TESTS: ${{ inputs.skip-tests }}
77+
MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
78+
SONATYPE_TOKEN_USERNAME: ${{ secrets.SONATYPE_TOKEN_USERNAME }}
79+
SONATYPE_TOKEN_PASSWORD: ${{ secrets.SONATYPE_TOKEN_PASSWORD }}
80+
run: make release-dry-run
5981

60-
- name: Perform dry-run release
61-
env:
62-
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
63-
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
64-
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
65-
if: ${{ github.event.inputs.dryrun == true }}
66-
run: make release-dry-run
82+
- name: Upload release logs
83+
if: failure()
84+
uses: actions/upload-artifact@v4
85+
with:
86+
name: maven-stdout
87+
path: /tmp/java-driver-release-logs/*.log
6788

68-
- name: Push changes to SCM
69-
if: ${{ github.event.inputs.dryrun == false }}
70-
run: |
71-
git status && git log -3
72-
git push origin --follow-tags -v
89+
- name: Push changes to SCM
90+
if: ${{ inputs.dry-run == false && inputs.target-tag == 'scylla-4.x' }}
91+
run: |
92+
git status && git log -3
93+
git push origin --follow-tags -v

.github/workflows/tests@v1.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ on:
77
- "docs/**"
88
- .github/workflows/docs-pages.yml
99
- .github/workflows/docs-pr.yml
10-
- .github/workflows/re-release.yml
1110
- .github/workflows/release.yml
1211
- "*.md"
1312
- "*.sh"
@@ -20,7 +19,6 @@ on:
2019
- "docs/**"
2120
- .github/workflows/docs-pages.yml
2221
- .github/workflows/docs-pr.yml
23-
- .github/workflows/re-release.yml
2422
- .github/workflows/release.yml
2523
- "*.md"
2624
- "*.sh"

Makefile

Lines changed: 32 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,15 @@ CCM_SCYLLA_VERSION ?= master
1313

1414
SCYLLA_EXT_OPTS ?= --smp=2 --memory=4G
1515
MVNCMD ?= mvn -B -X -ntp
16-
GPG_PASSPHRASE ?=
17-
OSSRH_USERNAME ?=
16+
17+
MAVEN_GPG_PASSPHRASE ?=
18+
SONATYPE_TOKEN_USERNAME ?=
19+
SONATYPE_TOKEN_PASSWORD ?=
20+
1821
MAVEN_OPTS ?=
1922

23+
RELEASE_SKIP_TESTS ?=
24+
2025
ifeq (${CCM_CONFIG_DIR},)
2126
CCM_CONFIG_DIR = ~/.ccm
2227
endif
@@ -153,6 +158,14 @@ resolve-scylla-version: .prepare-get-version
153158
fi
154159
echo "$${SCYLLA_VERSION_RESOLVED}" >${SCYLLA_VERSION_FILE}
155160

161+
checkout-one-commit-before:
162+
@if [[ "${RELEASE_TARGET_TAG}" == 3.* ]]; then
163+
echo "Checking out one commit before ${RELEASE_TARGET_TAG}"
164+
git fetch --prune --unshallow || git fetch --prune || true
165+
git checkout ${RELEASE_TARGET_TAG}~1
166+
git tag -d ${RELEASE_TARGET_TAG}
167+
fi
168+
156169
download-cassandra: .prepare-scylla-ccm resolve-cassandra-version
157170
@if [[ -z "$${CASSANDRA_VERSION_RESOLVED}" ]]; then
158171
CASSANDRA_VERSION_RESOLVED=$$(cat '${CASSANDRA_VERSION_FILE}')
@@ -180,42 +193,44 @@ download-scylla: .prepare-scylla-ccm resolve-scylla-version
180193
rm -rf /tmp/download.ccm
181194

182195
.require-release-prepare-env:
183-
@if [[ -z "${GPG_PASSPHRASE}" ]]; then
184-
echo "GPG_PASSPHRASE is empty"
196+
@if [[ -z "${MAVEN_GPG_PASSPHRASE}" ]]; then
197+
echo "MAVEN_GPG_PASSPHRASE is empty"
185198
exit 1
186199
fi
187200

188201
.require-release-env:
189-
@if [[ -z "${GPG_PASSPHRASE}" ]]; then
190-
echo "GPG_PASSPHRASE is empty"
202+
@if [[ -z "${MAVEN_GPG_PASSPHRASE}" ]]; then
203+
echo "MAVEN_GPG_PASSPHRASE is empty"
191204
exit 1
192205
fi
193-
if [[ -z "${OSSRH_USERNAME}" ]]; then
194-
echo "OSSRH_USERNAME is empty"
206+
if [[ -z "${SONATYPE_TOKEN_USERNAME}" ]]; then
207+
echo "SONATYPE_TOKEN_USERNAME is empty"
195208
exit 1
196209
fi
197-
if [[ -z "${OSSRH_PASSWORD}" ]]; then
198-
echo "OSSRH_PASSWORD is empty"
210+
if [[ -z "${SONATYPE_TOKEN_PASSWORD}" ]]; then
211+
echo "SONATYPE_TOKEN_PASSWORD is empty"
199212
exit 1
200213
fi
201214

202215
release-prepare: .require-release-prepare-env
203-
@if [[ -n "${RELEASE_SKIP_TESTS}" ]]; then
216+
@if [[ "${RELEASE_SKIP_TESTS}" == "true" ]] || [[ "${RELEASE_SKIP_TESTS}" == "1" ]]; then
204217
export MAVEN_OPTS="${MAVEN_OPTS} -DskipTests=true -DskipITs=true"
205218
fi
206-
$(MVNCMD) release:prepare -DpushChanges=false -Dgpg.passphrase=${GPG_PASSPHRASE}
219+
$(MVNCMD) release:prepare -DpushChanges=false -Dxml-format.skip=true
207220

208221
release: .require-release-env
209-
@if [[ -n "${RELEASE_SKIP_TESTS}" ]]; then
222+
@if [[ "${RELEASE_SKIP_TESTS}" == "true" ]] || [[ "${RELEASE_SKIP_TESTS}" == "1" ]]; then
210223
export MAVEN_OPTS="${MAVEN_OPTS} -DskipTests=true -DskipITs=true"
211224
fi
212-
$(MVNCMD) release:perform -Drelease.autopublish=true -Dgpg.passphrase=${GPG_PASSPHRASE} > >(tee /tmp/logs-stdout.log) 2> >(tee /tmp/logs-stderr.log)
225+
mkdir /tmp/java-driver-release-logs/ 2>/dev/null || true
226+
$(MVNCMD) release:perform -Drelease.autopublish=true > >(tee /tmp/java-driver-release-logs/stdout.log) 2> >(tee /tmp/java-driver-release-logs/stderr.log)
213227

214228
release-dry-run: .require-release-env
215-
@if [[ -n "${RELEASE_SKIP_TESTS}" ]]; then
229+
@if [[ "${RELEASE_SKIP_TESTS}" == "true" ]] || [[ "${RELEASE_SKIP_TESTS}" == "1" ]]; then
216230
export MAVEN_OPTS="${MAVEN_OPTS} -DskipTests=true -DskipITs=true"
217231
fi
218-
$(MVNCMD) release:perform -Dgpg.passphrase=${GPG_PASSPHRASE} > >(tee /tmp/logs-stdout.log) 2> >(tee /tmp/logs-stderr.log)
232+
mkdir /tmp/java-driver-release-logs/ 2>/dev/null || true
233+
$(MVNCMD) release:perform > >(tee /tmp/java-driver-release-logs/stdout.log) 2> >(tee /tmp/java-driver-release-logs/stderr.log)
219234

220235
compile-all: .install-guava-shaded
221236
mvn -B compile test-compile -Dfmt.skip=true -Dclirr.skip=true -Danimal.sniffer.skip=true
@@ -264,6 +279,7 @@ clean:
264279
find -name 'pom.xml.next' -delete
265280
find -name 'target' -exec rm -rf {} +
266281
find -name 'dependency-reduced-pom.xml' -exec rm -f {} +
282+
rm -f release.properties 2>/dev/null
267283
for dir in driver-core driver-examples driver-extras driver-mapping driver-tests driver-dist testing; do
268284
rm -rf $$dir 2>/dev/null
269285
done

distribution-source/pom.xml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -71,13 +71,6 @@
7171
<skip>true</skip>
7272
</configuration>
7373
</plugin>
74-
<plugin>
75-
<groupId>org.sonatype.plugins</groupId>
76-
<artifactId>nexus-staging-maven-plugin</artifactId>
77-
<configuration>
78-
<skipNexusStagingDeployMojo>true</skipNexusStagingDeployMojo>
79-
</configuration>
80-
</plugin>
8174
</plugins>
8275
</build>
8376
<profiles>

distribution-tests/pom.xml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -115,13 +115,6 @@
115115
<skip>true</skip>
116116
</configuration>
117117
</plugin>
118-
<plugin>
119-
<groupId>org.sonatype.plugins</groupId>
120-
<artifactId>nexus-staging-maven-plugin</artifactId>
121-
<configuration>
122-
<skipNexusStagingDeployMojo>true</skipNexusStagingDeployMojo>
123-
</configuration>
124-
</plugin>
125118
</plugins>
126119
</build>
127120
</project>

distribution/pom.xml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -109,13 +109,6 @@
109109
<skip>true</skip>
110110
</configuration>
111111
</plugin>
112-
<plugin>
113-
<groupId>org.sonatype.plugins</groupId>
114-
<artifactId>nexus-staging-maven-plugin</artifactId>
115-
<configuration>
116-
<skipNexusStagingDeployMojo>true</skipNexusStagingDeployMojo>
117-
</configuration>
118-
</plugin>
119112
<plugin>
120113
<groupId>org.apache.maven.plugins</groupId>
121114
<artifactId>maven-gpg-plugin</artifactId>

examples/pom.xml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -210,13 +210,6 @@
210210
<skip>true</skip>
211211
</configuration>
212212
</plugin>
213-
<plugin>
214-
<groupId>org.sonatype.plugins</groupId>
215-
<artifactId>nexus-staging-maven-plugin</artifactId>
216-
<configuration>
217-
<skipNexusStagingDeployMojo>true</skipNexusStagingDeployMojo>
218-
</configuration>
219-
</plugin>
220213
</plugins>
221214
</build>
222215
</project>

integration-tests/pom.xml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -336,13 +336,6 @@
336336
<skip>true</skip>
337337
</configuration>
338338
</plugin>
339-
<plugin>
340-
<groupId>org.sonatype.plugins</groupId>
341-
<artifactId>nexus-staging-maven-plugin</artifactId>
342-
<configuration>
343-
<skipNexusStagingDeployMojo>true</skipNexusStagingDeployMojo>
344-
</configuration>
345-
</plugin>
346339
</plugins>
347340
</build>
348341
</project>

osgi-tests/pom.xml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -296,13 +296,6 @@
296296
<skip>true</skip>
297297
</configuration>
298298
</plugin>
299-
<plugin>
300-
<groupId>org.sonatype.plugins</groupId>
301-
<artifactId>nexus-staging-maven-plugin</artifactId>
302-
<configuration>
303-
<skipNexusStagingDeployMojo>true</skipNexusStagingDeployMojo>
304-
</configuration>
305-
</plugin>
306299
</plugins>
307300
</build>
308301
</project>

0 commit comments

Comments
 (0)