Skip to content

Commit aac18ee

Browse files
committed
Add release action
1 parent 21252a7 commit aac18ee

File tree

3 files changed

+139
-3
lines changed

3 files changed

+139
-3
lines changed

.github/release-settings.xml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?xml version="1.0"?>
2+
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 https://maven.apache.org/xsd/settings-1.0.0.xsd">
4+
<pluginGroups>
5+
<pluginGroup>eu.maveniverse.maven.plugins</pluginGroup>
6+
</pluginGroups>
7+
8+
<servers>
9+
<server>
10+
<id>sonatype-central-portal</id>
11+
<username>${env.MAVEN_USER}</username>
12+
<password>${env.MAVEN_PASSWORD}</password>
13+
<configuration>
14+
<njord.publisher>sonatype-cp</njord.publisher>
15+
<njord.releaseUrl>njord:template:release-sca</njord.releaseUrl>
16+
</configuration>
17+
</server>
18+
</servers>
19+
20+
</settings>

.github/workflows/release.yml

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
name: Release
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
releaseVersion:
7+
description: "Release version, e.g. 0.3.6 (optional — auto-detected from the current POM)"
8+
required: false
9+
10+
jobs:
11+
release:
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Validate release version
16+
if: ${{ github.event.inputs.releaseVersion != '' }}
17+
run: |
18+
RELEASE=${{ github.event.inputs.releaseVersion }}
19+
if [[ ! $RELEASE =~ ^[0-9]+\.[0-9]+\.[0-9]+(-SNAPSHOT)?$ ]]; then
20+
echo "Error: releaseVersion '$RELEASE' is not in the correct format x.y.z or x.y.z-SNAPSHOT"
21+
exit 1
22+
fi
23+
24+
- name: Checkout
25+
uses: actions/checkout@v4
26+
with:
27+
fetch-depth: 0
28+
29+
- name: Set up Java
30+
uses: actions/setup-java@v4
31+
with:
32+
java-version: '21'
33+
distribution: 'adopt'
34+
35+
- name: Configure git
36+
run: |
37+
git config user.email "[email protected]"
38+
git config user.name "GitHub Actions"
39+
40+
- name: Prepare Release
41+
env:
42+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
43+
run: |
44+
MVN_ARGS=""
45+
if [ -n "${{ github.event.inputs.releaseVersion }}" ]; then
46+
MVN_ARGS="$MVN_ARGS -DreleaseVersion=${{ github.event.inputs.releaseVersion }}"
47+
fi
48+
mvn -B release:prepare $MVN_ARGS
49+
50+
- name: Determine release version
51+
id: version
52+
run: |
53+
export TAG=$(grep 'scm.tag=' release.properties | cut -d'=' -f2)
54+
export VERSION=${TAG#JavaFastPFOR-}
55+
56+
echo "released_tag=${TAG}" >> $GITHUB_OUTPUT
57+
echo "released_version=${VERSION}" >> $GITHUB_OUTPUT
58+
59+
echo "Releasing tag: ${TAG}"
60+
echo "Releasing version: ${VERSION}"
61+
62+
- name: Release
63+
env:
64+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
65+
MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
66+
MAVEN_GPG_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
67+
MAVEN_USER: ${{ secrets.MAVEN_USER }}
68+
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}
69+
run: |
70+
mvn -B release:perform -Darguments="-DskipTests -Dnjord.autoPublish -s .github/release-settings.xml"
71+
72+
- name: Create GitHub Release
73+
run: gh release create "${{ steps.version.outputs.released_tag }}" --generate-notes --title "Version ${{ steps.version.outputs.released_version }}"
74+
env:
75+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

pom.xml

Lines changed: 44 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
<maven.compiler.target>21</maven.compiler.target>
1010
<maven.compiler.release>21</maven.compiler.release>
1111
<encoding>UTF-8</encoding>
12+
<njord.version>0.8.5</njord.version>
1213
</properties>
1314
<licenses>
1415
<license>
@@ -19,11 +20,25 @@
1920
</license>
2021
</licenses>
2122
<scm>
22-
<connection>scm:git:git@github.com:fast-pack/JavaFastPFOR.git</connection>
23-
<url>scm:git:git@github.com:fast-pack/JavaFastPFOR.git</url>
24-
<developerConnection>scm:git:git@github.com:fast-pack/JavaFastPFOR.git</developerConnection>
23+
<connection>scm:git:https://github.com/fast-pack/JavaFastPFOR.git</connection>
24+
<url>scm:git:https://github.com/fast-pack/JavaFastPFOR.git</url>
25+
<developerConnection>scm:git:https://github.com/fast-pack/JavaFastPFOR.git</developerConnection>
2526
<tag>HEAD</tag>
2627
</scm>
28+
29+
<distributionManagement>
30+
<snapshotRepository>
31+
<id>sonatype-central-portal</id>
32+
<name>Sonatype Central Portal</name>
33+
<url>https://central.sonatype.com/repository/maven-snapshots/</url>
34+
</snapshotRepository>
35+
<repository>
36+
<id>sonatype-central-portal</id>
37+
<name>Sonatype Central Portal</name>
38+
<url>https://repo.maven.apache.org/maven2/</url>
39+
</repository>
40+
</distributionManagement>
41+
2742
<developers>
2843
<developer>
2944
<id>lemire</id>
@@ -60,6 +75,13 @@
6075
<url>https://github.com/fast-pack/JavaFastPFOR/issues</url>
6176
</issueManagement>
6277
<build>
78+
<extensions>
79+
<extension>
80+
<groupId>eu.maveniverse.maven.njord</groupId>
81+
<artifactId>extension3</artifactId>
82+
<version>${njord.version}</version>
83+
</extension>
84+
</extensions>
6385
<plugins>
6486
<plugin>
6587
<groupId>org.apache.maven.plugins</groupId>
@@ -174,10 +196,29 @@
174196
<autoVersionSubmodules>true</autoVersionSubmodules>
175197
</configuration>
176198
</plugin>
199+
<plugin>
200+
<groupId>org.apache.maven.plugins</groupId>
201+
<artifactId>maven-gpg-plugin</artifactId>
202+
<version>3.2.8</version>
203+
<executions>
204+
<execution>
205+
<id>sign-artifacts</id>
206+
<phase>verify</phase>
207+
<goals>
208+
<goal>sign</goal>
209+
</goals>
210+
</execution>
211+
</executions>
212+
</plugin>
177213
</plugins>
178214

179215
<pluginManagement>
180216
<plugins>
217+
<plugin>
218+
<groupId>eu.maveniverse.maven.plugins</groupId>
219+
<artifactId>njord</artifactId>
220+
<version>${njord.version}</version>
221+
</plugin>
181222
<plugin>
182223
<artifactId>maven-clean-plugin</artifactId>
183224
<version>2.5</version>

0 commit comments

Comments
 (0)