Skip to content

Commit ef4db99

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

File tree

2 files changed

+230
-9
lines changed

2 files changed

+230
-9
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: 122 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,10 @@
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>
@@ -316,4 +308,125 @@
316308

317309
</dependencies>
318310

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

0 commit comments

Comments
 (0)