Skip to content

Commit 7a244f7

Browse files
committed
cicd: add release workflow
1 parent 361c643 commit 7a244f7

File tree

2 files changed

+283
-12
lines changed

2 files changed

+283
-12
lines changed

.github/workflows/release.yml

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
name: Release
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
dry-run:
7+
type: boolean
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
20+
21+
jobs:
22+
release:
23+
name: Release
24+
runs-on: ubuntu-latest
25+
26+
permissions:
27+
contents: write
28+
29+
env:
30+
MVNCMD: mvn -B -X -ntp
31+
32+
steps:
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

pom.xml

Lines changed: 175 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,18 @@
22

33
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
44
<modelVersion>4.0.0</modelVersion>
5-
<groupId>io.kafka.connect</groupId>
5+
<groupId>com.scylladb</groupId>
66
<artifactId>kafka-connect-scylladb</artifactId>
77
<name>kafka-connect-scylladb</name>
8-
<version>1.1.1</version>
8+
<version>1.1.2-SNAPSHOT</version>
99
<description>A Kafka Connect plugin for Scylla Database</description>
1010
<url>https://github.com/scylla/kafka-connect-scylladb</url>
1111
<inceptionYear>2020</inceptionYear>
1212

13-
<scm>
14-
<connection>scm:git:https://github.com/scylla/kafka-connect-scylladb.git</connection>
15-
<developerConnection>scm:git:[email protected]:scylla/kafka-connect-scylladb.git
16-
</developerConnection>
17-
<url>https://github.com/scylladb/kafka-connect-scylladb</url>
18-
<tag>HEAD</tag>
19-
</scm>
20-
2113
<properties>
2214
<project.inceptionYear>2020</project.inceptionYear>
2315
<license.current.year>2020</license.current.year>
24-
<kafka.connect.maven.plugin.version>0.11.1</kafka.connect.maven.plugin.version>
16+
<kafka.connect.maven.plugin.version>0.12.0</kafka.connect.maven.plugin.version>
2517
<junit.surefire.plugin.version>1.2.0</junit.surefire.plugin.version>
2618
<surefire.version>3.0.0-M5</surefire.version>
2719
<failsafe.version>3.0.0-M5</failsafe.version>
@@ -32,11 +24,42 @@
3224
<!-- transitive dependency versions -->
3325
<jackson-databind.version>2.13.4.2</jackson-databind.version>
3426
<guava.version>24.1.1-jre</guava.version>
35-
27+
<gpg.passphrase/>
28+
<release.autopublish>false</release.autopublish>
3629
</properties>
3730

3831
<build>
3932
<plugins>
33+
<plugin>
34+
<groupId>org.apache.maven.plugins</groupId>
35+
<artifactId>maven-surefire-plugin</artifactId>
36+
<version>3.5.3</version>
37+
</plugin>
38+
<plugin>
39+
<groupId>org.apache.maven.plugins</groupId>
40+
<artifactId>maven-gpg-plugin</artifactId>
41+
<version>3.2.7</version>
42+
</plugin>
43+
<plugin>
44+
<groupId>org.apache.maven.plugins</groupId>
45+
<artifactId>maven-install-plugin</artifactId>
46+
<version>3.1.4</version>
47+
</plugin>
48+
<plugin>
49+
<groupId>org.apache.maven.plugins</groupId>
50+
<artifactId>maven-deploy-plugin</artifactId>
51+
<version>3.1.4</version>
52+
</plugin>
53+
<plugin>
54+
<groupId>org.apache.maven.plugins</groupId>
55+
<artifactId>maven-release-plugin</artifactId>
56+
<version>3.1.1</version>
57+
</plugin>
58+
<plugin>
59+
<groupId>org.sonatype.central</groupId>
60+
<artifactId>central-publishing-maven-plugin</artifactId>
61+
<version>0.8.0</version>
62+
</plugin>
4063
<plugin>
4164
<groupId>org.apache.maven.plugins</groupId>
4265
<artifactId>maven-assembly-plugin</artifactId>
@@ -180,6 +203,25 @@
180203
</execution>
181204
</executions>
182205
</plugin>
206+
<plugin>
207+
<artifactId>maven-release-plugin</artifactId>
208+
<configuration>
209+
<tagNameFormat>v@{project.version}</tagNameFormat>
210+
<autoVersionSubmodules>true</autoVersionSubmodules>
211+
<releaseProfiles>release</releaseProfiles>
212+
<useReleaseProfile>false</useReleaseProfile>
213+
<localCheckout>true</localCheckout>
214+
<pushChanges>false</pushChanges>
215+
<arguments>-Dgpg.passphrase=${gpg.passphrase} -Drelease.autopublish=${release.autopublish}</arguments>
216+
</configuration>
217+
<dependencies>
218+
<dependency>
219+
<groupId>org.apache.maven.scm</groupId>
220+
<artifactId>maven-scm-provider-gitexe</artifactId>
221+
<version>2.1.0</version>
222+
</dependency>
223+
</dependencies>
224+
</plugin>
183225
</plugins>
184226
<resources>
185227
<!-- Apply the properties set in the POM to the resource files -->
@@ -316,4 +358,125 @@
316358

317359
</dependencies>
318360

361+
<profiles>
362+
<profile>
363+
<id>release-sign-artifacts</id>
364+
<activation>
365+
<property>
366+
<name>performRelease</name>
367+
<value>true</value>
368+
</property>
369+
</activation>
370+
<build>
371+
<plugins>
372+
<plugin>
373+
<groupId>org.apache.maven.plugins</groupId>
374+
<artifactId>maven-gpg-plugin</artifactId>
375+
<executions>
376+
<execution>
377+
<id>sign-artifacts</id>
378+
<phase>verify</phase>
379+
<goals>
380+
<goal>sign</goal>
381+
</goals>
382+
</execution>
383+
</executions>
384+
</plugin>
385+
</plugins>
386+
</build>
387+
</profile>
388+
389+
<profile>
390+
<id>release</id>
391+
<build>
392+
<plugins>
393+
<plugin>
394+
<artifactId>maven-source-plugin</artifactId>
395+
<executions>
396+
<execution>
397+
<id>attach-sources</id>
398+
<goals>
399+
<goal>jar-no-fork</goal>
400+
</goals>
401+
</execution>
402+
</executions>
403+
</plugin>
404+
<plugin>
405+
<artifactId>maven-javadoc-plugin</artifactId>
406+
<executions>
407+
<execution>
408+
<id>attach-javadocs</id>
409+
<goals>
410+
<goal>jar</goal>
411+
</goals>
412+
</execution>
413+
</executions>
414+
</plugin>
415+
<plugin>
416+
<groupId>org.apache.maven.plugins</groupId>
417+
<artifactId>maven-gpg-plugin</artifactId>
418+
<executions>
419+
<execution>
420+
<id>sign-artifacts</id>
421+
<phase>verify</phase>
422+
<goals>
423+
<goal>sign</goal>
424+
</goals>
425+
<configuration>
426+
<gpgArguments>
427+
<arg>--pinentry-mode</arg>
428+
<arg>loopback</arg>
429+
</gpgArguments>
430+
</configuration>
431+
</execution>
432+
</executions>
433+
</plugin>
434+
<plugin>
435+
<groupId>org.sonatype.central</groupId>
436+
<artifactId>central-publishing-maven-plugin</artifactId>
437+
<extensions>true</extensions>
438+
<configuration>
439+
<publishingServerId>central</publishingServerId>
440+
<autoPublish>${release.autopublish}</autoPublish>
441+
<waitUntil>validated</waitUntil>
442+
</configuration>
443+
</plugin>
444+
</plugins>
445+
</build>
446+
</profile>
447+
</profiles>
448+
449+
<scm>
450+
<connection>scm:git:https://github.com/scylladb/kafka-connect-scylladb</connection>
451+
<developerConnection>scm:git:https://github.com/scylladb/kafka-connect-scylladb</developerConnection>
452+
<url>https://github.com/scylladb/kafka-connect-scylladb</url>
453+
<tag>HEAD</tag>
454+
</scm>
455+
456+
<licenses>
457+
<license>
458+
<name>Apache 2</name>
459+
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
460+
<distribution>repo</distribution>
461+
<comments>Apache License Version 2.0</comments>
462+
</license>
463+
</licenses>
464+
465+
<distributionManagement>
466+
<snapshotRepository>
467+
<id>central</id>
468+
<url>https://central.sonatype.com/repository/maven-snapshots</url>
469+
</snapshotRepository>
470+
<repository>
471+
<id>central</id>
472+
<url>https://central.sonatype.com/repository/maven-releases</url>
473+
</repository>
474+
</distributionManagement>
475+
476+
<developers>
477+
<developer>
478+
<name>Various</name>
479+
<organization>ScyllaDB</organization>
480+
</developer>
481+
</developers>
319482
</project>

0 commit comments

Comments
 (0)