Skip to content

Commit 597609f

Browse files
committed
cicd: add release workflow
1 parent 361c643 commit 597609f

File tree

2 files changed

+252
-11
lines changed

2 files changed

+252
-11
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 "github-promoter@scylladb.com"
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: 144 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,15 @@
55
<groupId>io.kafka.connect</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:git@github.com: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,7 +24,8 @@
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>
@@ -180,6 +173,25 @@
180173
</execution>
181174
</executions>
182175
</plugin>
176+
<plugin>
177+
<artifactId>maven-release-plugin</artifactId>
178+
<configuration>
179+
<tagNameFormat>v@{project.version}</tagNameFormat>
180+
<autoVersionSubmodules>true</autoVersionSubmodules>
181+
<releaseProfiles>release</releaseProfiles>
182+
<useReleaseProfile>false</useReleaseProfile>
183+
<localCheckout>true</localCheckout>
184+
<pushChanges>false</pushChanges>
185+
<arguments>-Dgpg.passphrase=${gpg.passphrase} -Drelease.autopublish=${release.autopublish}</arguments>
186+
</configuration>
187+
<dependencies>
188+
<dependency>
189+
<groupId>org.apache.maven.scm</groupId>
190+
<artifactId>maven-scm-provider-gitexe</artifactId>
191+
<version>2.1.0</version>
192+
</dependency>
193+
</dependencies>
194+
</plugin>
183195
</plugins>
184196
<resources>
185197
<!-- Apply the properties set in the POM to the resource files -->
@@ -316,4 +328,125 @@
316328

317329
</dependencies>
318330

331+
<profiles>
332+
<profile>
333+
<id>release-sign-artifacts</id>
334+
<activation>
335+
<property>
336+
<name>performRelease</name>
337+
<value>true</value>
338+
</property>
339+
</activation>
340+
<build>
341+
<plugins>
342+
<plugin>
343+
<groupId>org.apache.maven.plugins</groupId>
344+
<artifactId>maven-gpg-plugin</artifactId>
345+
<executions>
346+
<execution>
347+
<id>sign-artifacts</id>
348+
<phase>verify</phase>
349+
<goals>
350+
<goal>sign</goal>
351+
</goals>
352+
</execution>
353+
</executions>
354+
</plugin>
355+
</plugins>
356+
</build>
357+
</profile>
358+
359+
<profile>
360+
<id>release</id>
361+
<build>
362+
<plugins>
363+
<plugin>
364+
<artifactId>maven-source-plugin</artifactId>
365+
<executions>
366+
<execution>
367+
<id>attach-sources</id>
368+
<goals>
369+
<goal>jar-no-fork</goal>
370+
</goals>
371+
</execution>
372+
</executions>
373+
</plugin>
374+
<plugin>
375+
<artifactId>maven-javadoc-plugin</artifactId>
376+
<executions>
377+
<execution>
378+
<id>attach-javadocs</id>
379+
<goals>
380+
<goal>jar</goal>
381+
</goals>
382+
</execution>
383+
</executions>
384+
</plugin>
385+
<plugin>
386+
<groupId>org.apache.maven.plugins</groupId>
387+
<artifactId>maven-gpg-plugin</artifactId>
388+
<executions>
389+
<execution>
390+
<id>sign-artifacts</id>
391+
<phase>verify</phase>
392+
<goals>
393+
<goal>sign</goal>
394+
</goals>
395+
<configuration>
396+
<gpgArguments>
397+
<arg>--pinentry-mode</arg>
398+
<arg>loopback</arg>
399+
</gpgArguments>
400+
</configuration>
401+
</execution>
402+
</executions>
403+
</plugin>
404+
<plugin>
405+
<groupId>org.sonatype.central</groupId>
406+
<artifactId>central-publishing-maven-plugin</artifactId>
407+
<extensions>true</extensions>
408+
<configuration>
409+
<publishingServerId>central</publishingServerId>
410+
<autoPublish>${release.autopublish}</autoPublish>
411+
<waitUntil>validated</waitUntil>
412+
</configuration>
413+
</plugin>
414+
</plugins>
415+
</build>
416+
</profile>
417+
</profiles>
418+
419+
<scm>
420+
<connection>scm:git:https://github.com/scylladb/kafka-connect-scylladb</connection>
421+
<developerConnection>scm:git:https://github.com/scylladb/kafka-connect-scylladb</developerConnection>
422+
<url>https://github.com/scylladb/kafka-connect-scylladb</url>
423+
<tag>HEAD</tag>
424+
</scm>
425+
426+
<licenses>
427+
<license>
428+
<name>Apache 2</name>
429+
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
430+
<distribution>repo</distribution>
431+
<comments>Apache License Version 2.0</comments>
432+
</license>
433+
</licenses>
434+
435+
<distributionManagement>
436+
<snapshotRepository>
437+
<id>central</id>
438+
<url>https://central.sonatype.com/repository/maven-snapshots</url>
439+
</snapshotRepository>
440+
<repository>
441+
<id>central</id>
442+
<url>https://central.sonatype.com/repository/maven-releases</url>
443+
</repository>
444+
</distributionManagement>
445+
446+
<developers>
447+
<developer>
448+
<name>Various</name>
449+
<organization>ScyllaDB</organization>
450+
</developer>
451+
</developers>
319452
</project>

0 commit comments

Comments
 (0)