Skip to content

Commit 1a4399e

Browse files
feat: adding release workflow (#3)
Signed-off-by: Janos Sarusi-Kis <janossk@cisco.com>
1 parent caf22fe commit 1a4399e

5 files changed

Lines changed: 226 additions & 3 deletions

File tree

.github/workflows/release.yaml

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
# Copyright AGNTCY Contributors (https://github.com/agntcy)
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
---
5+
name: release
6+
7+
on:
8+
push:
9+
tags: ['v*'] # v0.1.0 -> io.agntcy.slim:slim-a2a-java:0.1.0
10+
workflow_dispatch:
11+
inputs:
12+
version:
13+
description: "Version without leading v"
14+
required: true
15+
type: string
16+
17+
permissions:
18+
contents: read
19+
20+
jobs:
21+
release-maven-central:
22+
name: Release to Maven Central
23+
runs-on: ubuntu-latest
24+
steps:
25+
- uses: actions/checkout@v4
26+
with:
27+
persist-credentials: false
28+
29+
- name: Setup Java 21
30+
uses: actions/setup-java@v4
31+
with:
32+
distribution: temurin
33+
java-version: '21'
34+
cache: maven
35+
36+
- name: Extract version
37+
id: v
38+
env:
39+
REF_NAME: "${{ github.ref_name }}"
40+
INPUT_VERSION: "${{ inputs.version }}"
41+
run: |
42+
if [ -n "$INPUT_VERSION" ]; then VERSION="$INPUT_VERSION"; else VERSION="${REF_NAME#v}"; fi
43+
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
44+
45+
- name: Configure Maven Central credentials
46+
env:
47+
MVN_TOKEN_NAME: ${{ secrets.MVN_TOKEN_NAME }}
48+
MVN_TOKEN_PASSWORD: ${{ secrets.MVN_TOKEN_PASSWORD }}
49+
run: |
50+
mkdir -p ~/.m2
51+
cat > ~/.m2/settings.xml << 'EOF'
52+
<settings xmlns="http://maven.apache.org/SETTINGS/1.2.0">
53+
<servers><server>
54+
<id>central</id>
55+
<username>${env.MVN_TOKEN_NAME}</username>
56+
<password>${env.MVN_TOKEN_PASSWORD}</password>
57+
</server></servers>
58+
</settings>
59+
EOF
60+
61+
- name: Import GPG signing key
62+
env:
63+
GPG_SIGNING_KEY: ${{ secrets.GPG_SIGNING_KEY }}
64+
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
65+
run: echo "$GPG_SIGNING_KEY" | gpg --batch --yes --import --pinentry-mode loopback --passphrase "$GPG_PASSPHRASE"
66+
67+
- name: Deploy to Maven Central staging
68+
env:
69+
MVN_TOKEN_NAME: ${{ secrets.MVN_TOKEN_NAME }}
70+
MVN_TOKEN_PASSWORD: ${{ secrets.MVN_TOKEN_PASSWORD }}
71+
GPG_SIGNING_KEY: ${{ secrets.GPG_SIGNING_KEY }}
72+
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
73+
run: |
74+
mvn deploy -Drevision="${{ steps.v.outputs.version }}" -DskipTests \
75+
-DaltDeploymentRepository=central::default::https://ossrh-staging-api.central.sonatype.com/service/local/staging/deploy/maven2/
76+
77+
- name: Transfer staged deployment to Central Portal
78+
env:
79+
MVN_TOKEN_NAME: ${{ secrets.MVN_TOKEN_NAME }}
80+
MVN_TOKEN_PASSWORD: ${{ secrets.MVN_TOKEN_PASSWORD }}
81+
run: |
82+
AUTH=$(echo -n "$MVN_TOKEN_NAME:$MVN_TOKEN_PASSWORD" | base64 | tr -d '\n')
83+
curl -sS -X POST -H "Authorization: Bearer $AUTH" \
84+
"https://ossrh-staging-api.central.sonatype.com/manual/upload/defaultRepository/io.agntcy?publishing_type=automatic"

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ target/
55
*.ear
66
*.class
77
dependency-reduced-pom.xml
8+
.flattened-pom.xml
89

910
# IDE
1011
.idea/

examples/echo-agent/pom.xml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<parent>
88
<groupId>io.agntcy.slim</groupId>
99
<artifactId>slim-a2a-java-parent</artifactId>
10-
<version>0.1.0-SNAPSHOT</version>
10+
<version>${revision}</version>
1111
<relativePath>../../pom.xml</relativePath>
1212
</parent>
1313

@@ -17,6 +17,11 @@
1717
<name>SLIM A2A Java Examples - Echo Agent</name>
1818
<description>Echo agent example using A2A over SLIM transport</description>
1919

20+
<properties>
21+
<!-- Example module — never publish to Maven Central -->
22+
<maven.deploy.skip>true</maven.deploy.skip>
23+
</properties>
24+
2025
<dependencies>
2126
<dependency>
2227
<groupId>io.agntcy.slim</groupId>

pom.xml

Lines changed: 75 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>io.agntcy.slim</groupId>
88
<artifactId>slim-a2a-java-parent</artifactId>
9-
<version>0.1.0-SNAPSHOT</version>
9+
<version>${revision}</version>
1010
<packaging>pom</packaging>
1111

1212
<name>SLIM A2A Java</name>
@@ -20,12 +20,26 @@
2020
</license>
2121
</licenses>
2222

23+
<developers>
24+
<developer>
25+
<name>AGNTCY Contributors</name>
26+
<url>https://github.com/agntcy</url>
27+
</developer>
28+
</developers>
29+
30+
<scm>
31+
<url>https://github.com/agntcy/slim-a2a-java</url>
32+
<connection>scm:git:git://github.com/agntcy/slim-a2a-java.git</connection>
33+
<developerConnection>scm:git:ssh://git@github.com/agntcy/slim-a2a-java.git</developerConnection>
34+
</scm>
35+
2336
<modules>
2437
<module>slim-a2a</module>
2538
<module>examples/echo-agent</module>
2639
</modules>
2740

2841
<properties>
42+
<revision>0.1.0</revision>
2943
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
3044
<maven.compiler.source>21</maven.compiler.source>
3145
<maven.compiler.target>21</maven.compiler.target>
@@ -103,5 +117,65 @@
103117
</plugin>
104118
</plugins>
105119
</pluginManagement>
120+
<plugins>
121+
<!-- CI-friendly versions: replace ${revision} with the real version in deployed poms -->
122+
<plugin>
123+
<groupId>org.codehaus.mojo</groupId>
124+
<artifactId>flatten-maven-plugin</artifactId>
125+
<version>1.5.0</version>
126+
<executions>
127+
<execution>
128+
<id>flatten</id>
129+
<phase>process-resources</phase>
130+
<goals>
131+
<goal>flatten</goal>
132+
</goals>
133+
<configuration>
134+
<updatePomFile>true</updatePomFile>
135+
<flattenMode>resolveCiFriendliesOnly</flattenMode>
136+
</configuration>
137+
</execution>
138+
</executions>
139+
</plugin>
140+
</plugins>
106141
</build>
142+
143+
<profiles>
144+
<!-- GPG signing for Maven Central (activated when GPG_SIGNING_KEY env var is set).
145+
Declared here (not just on slim-a2a) because this aggregator POM is itself a
146+
deployed artifact and Central rejects any deployed file without a signature. -->
147+
<profile>
148+
<id>sign</id>
149+
<activation>
150+
<property>
151+
<name>env.GPG_SIGNING_KEY</name>
152+
</property>
153+
</activation>
154+
<build>
155+
<plugins>
156+
<plugin>
157+
<groupId>org.apache.maven.plugins</groupId>
158+
<artifactId>maven-gpg-plugin</artifactId>
159+
<version>3.2.4</version>
160+
<executions>
161+
<execution>
162+
<id>sign-artifacts</id>
163+
<phase>verify</phase>
164+
<goals>
165+
<goal>sign</goal>
166+
</goals>
167+
<configuration>
168+
<gpgArguments>
169+
<arg>--pinentry-mode</arg>
170+
<arg>loopback</arg>
171+
</gpgArguments>
172+
<passphrase>${env.GPG_PASSPHRASE}</passphrase>
173+
</configuration>
174+
</execution>
175+
</executions>
176+
</plugin>
177+
</plugins>
178+
</build>
179+
</profile>
180+
</profiles>
107181
</project>

slim-a2a/pom.xml

Lines changed: 60 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,35 @@
77
<parent>
88
<groupId>io.agntcy.slim</groupId>
99
<artifactId>slim-a2a-java-parent</artifactId>
10-
<version>0.1.0-SNAPSHOT</version>
10+
<version>${revision}</version>
1111
</parent>
1212

1313
<artifactId>slim-a2a-java</artifactId>
1414
<packaging>jar</packaging>
1515

1616
<name>SLIM A2A Java Library</name>
1717
<description>A2A protocol adapter for SLIM transport in Java</description>
18+
<url>https://github.com/agntcy/slim-a2a-java</url>
19+
20+
<licenses>
21+
<license>
22+
<name>Apache-2.0</name>
23+
<url>https://www.apache.org/licenses/LICENSE-2.0</url>
24+
</license>
25+
</licenses>
26+
27+
<developers>
28+
<developer>
29+
<name>AGNTCY Contributors</name>
30+
<url>https://github.com/agntcy</url>
31+
</developer>
32+
</developers>
33+
34+
<scm>
35+
<url>https://github.com/agntcy/slim-a2a-java</url>
36+
<connection>scm:git:git://github.com/agntcy/slim-a2a-java.git</connection>
37+
<developerConnection>scm:git:ssh://git@github.com/agntcy/slim-a2a-java.git</developerConnection>
38+
</scm>
1839

1940
<dependencies>
2041
<dependency>
@@ -59,6 +80,44 @@
5980
</execution>
6081
</executions>
6182
</plugin>
83+
84+
<!-- Sources JAR (required by Maven Central) -->
85+
<plugin>
86+
<groupId>org.apache.maven.plugins</groupId>
87+
<artifactId>maven-source-plugin</artifactId>
88+
<version>3.3.0</version>
89+
<executions>
90+
<execution>
91+
<id>attach-sources</id>
92+
<goals>
93+
<goal>jar-no-fork</goal>
94+
</goals>
95+
</execution>
96+
</executions>
97+
</plugin>
98+
99+
<!-- Javadoc JAR (required by Maven Central) -->
100+
<plugin>
101+
<groupId>org.apache.maven.plugins</groupId>
102+
<artifactId>maven-javadoc-plugin</artifactId>
103+
<version>3.6.3</version>
104+
<configuration>
105+
<source>21</source>
106+
<doclint>none</doclint>
107+
<failOnError>false</failOnError>
108+
<additionalOptions>
109+
<additionalOption>--enable-preview</additionalOption>
110+
</additionalOptions>
111+
</configuration>
112+
<executions>
113+
<execution>
114+
<id>attach-javadocs</id>
115+
<goals>
116+
<goal>jar</goal>
117+
</goals>
118+
</execution>
119+
</executions>
120+
</plugin>
62121
</plugins>
63122
</build>
64123
</project>

0 commit comments

Comments
 (0)