Skip to content

Commit 690f8ef

Browse files
Copilotnomeguy
andcommitted
Add semantic-release configuration for Maven Central and GitHub releases
- Updated pom.xml with SCM, developers, and distribution management - Added Maven plugins for source, javadoc, GPG signing, and Nexus staging - Updated CI workflow to include semantic-release step - Renamed workflow from CI to build to match reference implementation - Configured workflow to release on master branch pushes Co-authored-by: nomeguy <85475922+nomeguy@users.noreply.github.com>
1 parent eb27b6d commit 690f8ef

2 files changed

Lines changed: 118 additions & 26 deletions

File tree

.github/workflows/ci.yml

Lines changed: 35 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,57 @@
1-
name: CI
1+
name: build
22

33
on:
44
push:
5-
branches: [ master, main ]
5+
branches:
6+
- master
67
pull_request:
7-
branches: [ master, main ]
88

99
jobs:
1010
build:
1111
runs-on: ubuntu-latest
1212

13-
strategy:
14-
matrix:
15-
java: [ '8', '11', '17', '21' ]
16-
1713
steps:
18-
- uses: actions/checkout@v4
19-
20-
- name: Set up JDK ${{ matrix.java }}
14+
- name: Checkout
15+
uses: actions/checkout@v4
16+
with:
17+
fetch-depth: 0
18+
19+
- name: Set up JDK 1.8
2120
uses: actions/setup-java@v4
2221
with:
23-
java-version: ${{ matrix.java }}
22+
java-version: '8'
2423
distribution: 'temurin'
2524
cache: maven
26-
25+
server-id: ossrh
26+
server-username: OSSRH_JIRA_USERNAME
27+
server-password: OSSRH_JIRA_PASSWORD
28+
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
29+
gpg-passphrase: GPG_PASSPHRASE
30+
2731
- name: Build with Maven
28-
run: mvn -B clean compile
29-
30-
- name: Run tests
31-
run: mvn -B test
32-
timeout-minutes: 15
33-
34-
- name: Verify package
35-
run: mvn -B verify
36-
37-
- name: Generate coverage report
38-
if: matrix.java == '11'
39-
run: mvn -B jacoco:report
40-
32+
run: mvn -B clean test jacoco:report
33+
4134
- name: Upload coverage to Codecov
42-
if: matrix.java == '11'
4335
uses: codecov/codecov-action@v3
4436
with:
4537
file: ./target/site/jacoco/jacoco.xml
4638
flags: unittests
4739
name: codecov-umbrella
4840
fail_ci_if_error: false
41+
42+
- name: Setup Node.js environment
43+
uses: actions/setup-node@v4
44+
with:
45+
node-version: 20
46+
47+
- name: Semantic Release
48+
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
49+
run: |
50+
npm install -g @conveyal/maven-semantic-release semantic-release
51+
semantic-release --prepare @conveyal/maven-semantic-release --publish @semantic-release/github,@conveyal/maven-semantic-release --verify-conditions @semantic-release/github,@conveyal/maven-semantic-release
52+
env:
53+
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
54+
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
55+
OSSRH_JIRA_USERNAME: ${{ secrets.OSSRH_JIRA_USERNAME }}
56+
OSSRH_JIRA_PASSWORD: ${{ secrets.OSSRH_JIRA_PASSWORD }}
57+

pom.xml

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,32 @@
2020
</license>
2121
</licenses>
2222

23+
<developers>
24+
<developer>
25+
<name>Yang Luo</name>
26+
<email>hsluoyz@qq.com</email>
27+
<organization>Casbin</organization>
28+
<organizationUrl>https://casbin.org</organizationUrl>
29+
</developer>
30+
</developers>
31+
32+
<scm>
33+
<connection>scm:git:git://github.com/jcasbin/jcasbin-rabbitmq-watcher.git</connection>
34+
<developerConnection>scm:git:ssh://github.com:jcasbin/jcasbin-rabbitmq-watcher.git</developerConnection>
35+
<url>https://github.com/jcasbin/jcasbin-rabbitmq-watcher/tree/master</url>
36+
</scm>
37+
38+
<distributionManagement>
39+
<snapshotRepository>
40+
<id>ossrh</id>
41+
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
42+
</snapshotRepository>
43+
<repository>
44+
<id>ossrh</id>
45+
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
46+
</repository>
47+
</distributionManagement>
48+
2349
<properties>
2450
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
2551
<maven.compiler.source>8</maven.compiler.source>
@@ -126,6 +152,63 @@
126152
</execution>
127153
</executions>
128154
</plugin>
155+
<plugin>
156+
<groupId>org.apache.maven.plugins</groupId>
157+
<artifactId>maven-source-plugin</artifactId>
158+
<version>3.3.0</version>
159+
<executions>
160+
<execution>
161+
<id>attach-sources</id>
162+
<goals>
163+
<goal>jar-no-fork</goal>
164+
</goals>
165+
</execution>
166+
</executions>
167+
</plugin>
168+
<plugin>
169+
<groupId>org.apache.maven.plugins</groupId>
170+
<artifactId>maven-javadoc-plugin</artifactId>
171+
<version>3.6.3</version>
172+
<executions>
173+
<execution>
174+
<id>attach-javadocs</id>
175+
<goals>
176+
<goal>jar</goal>
177+
</goals>
178+
</execution>
179+
</executions>
180+
</plugin>
181+
<plugin>
182+
<groupId>org.apache.maven.plugins</groupId>
183+
<artifactId>maven-gpg-plugin</artifactId>
184+
<version>3.1.0</version>
185+
<executions>
186+
<execution>
187+
<id>sign-artifacts</id>
188+
<phase>verify</phase>
189+
<goals>
190+
<goal>sign</goal>
191+
</goals>
192+
<configuration>
193+
<gpgArguments>
194+
<arg>--pinentry-mode</arg>
195+
<arg>loopback</arg>
196+
</gpgArguments>
197+
</configuration>
198+
</execution>
199+
</executions>
200+
</plugin>
201+
<plugin>
202+
<groupId>org.sonatype.plugins</groupId>
203+
<artifactId>nexus-staging-maven-plugin</artifactId>
204+
<version>1.6.13</version>
205+
<extensions>true</extensions>
206+
<configuration>
207+
<serverId>ossrh</serverId>
208+
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
209+
<autoReleaseAfterClose>true</autoReleaseAfterClose>
210+
</configuration>
211+
</plugin>
129212
</plugins>
130213
</build>
131214
</project>

0 commit comments

Comments
 (0)