Skip to content

Commit d72d893

Browse files
authored
Implementation of devonfw#813: Automated Release Process (devonfw#900)
1 parent c6befca commit d72d893

File tree

3 files changed

+89
-2
lines changed

3 files changed

+89
-2
lines changed

.github/workflows/release.yml

+65
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: Release
2+
3+
# Runs manually
4+
on:
5+
workflow_dispatch
6+
7+
jobs:
8+
release:
9+
name: Release on Sonatype OSS
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@v3
15+
with:
16+
submodules: recursive
17+
18+
- name: Set up Apache Maven Central
19+
uses: actions/setup-java@v3
20+
with:
21+
java-version: 11
22+
distribution: 'temurin'
23+
cache: 'maven'
24+
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }} # Value of the GPG private key to import
25+
gpg-passphrase: GPG_PASSPHRASE # env variable for GPG private key passphrase
26+
27+
- name: Publish to Apache Maven Central
28+
run: |
29+
maven_config="$(cat .mvn/maven.config)"
30+
current_version="${maven_config/#*-Drevision=}"
31+
current_version="${current_version/ */}"
32+
next_version="${current_version/-SNAPSHOT/}"
33+
sed -i "s/${current_version}/${next_version}/" .mvn/maven.config
34+
git config --global user.email ${{ secrets.BUILD_USER_EMAIL }}
35+
git config --global user.name ${{ secrets.BUILD_USER }}
36+
git add -f .mvn/maven.config
37+
git commit -m "set release version to ${next_version}"
38+
git tag -a "release/${next_version}" -m "tagged version ${next_version}"
39+
mvn --settings .mvn/settings.xml deploy -Pdeploy -Dgpg.pin.entry.mode=loopback -Dgpg.passphrase=${{ secrets.GPG_PASSPHRASE }}
40+
env:
41+
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
42+
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
43+
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
44+
45+
- name: set next version & create gitHub release
46+
run: |
47+
maven_config="$(cat .mvn/maven.config)"
48+
current_version="${maven_config/#*-Drevision=}"
49+
current_version="${current_version/ */}"
50+
current_segment="${current_version/*./}"
51+
(( next_segment=${current_segment}+1 ))
52+
while [ ${#next_segment} -ne 3 ]; do next_segment="0${next_segment}"; done
53+
next_version="${current_version%.*}.${next_segment}-SNAPSHOT"
54+
sed -i "s/${current_version}/${next_version}/" .mvn/maven.config
55+
git add -f .mvn/maven.config
56+
git commit -m "set next version to ${next_version}"
57+
git push
58+
git push --tags
59+
noDotVersion="${current_version//.}"
60+
gh release create "release/${current_version}" --title "${current_version}" --notes "# Download
61+
https://repo1.maven.org/maven2/com/devonfw/tools/ide/devonfw-ide-scripts/${old_version}/devonfw-ide-scripts-${current_version}.tar.gz
62+
# Changes
63+
https://github.com/devonfw/ide/blob/master/CHANGELOG.asciidoc#${noDotVersion}"
64+
env:
65+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

eclipse-m2e/pom.xml

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
</parent>
1111
<artifactId>devonfw-ide-eclipse-m2e</artifactId>
1212
<packaging>jar</packaging>
13+
<version>dev-SNAPSHOT</version>
1314
<name>${project.artifactId}</name>
1415
<description>Maven example project to trigger/enforce the installation of m2e plugins</description>
1516

pom.xml

+23-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<groupId>com.devonfw</groupId>
88
<artifactId>maven-parent</artifactId>
9-
<version>9</version>
9+
<version>11</version>
1010
</parent>
1111
<groupId>com.devonfw.tools.ide.dev</groupId>
1212
<artifactId>devonfw-ide</artifactId>
@@ -55,6 +55,27 @@
5555
</plugins>
5656
</build>
5757

58+
<profiles>
59+
<profile>
60+
<id>deploy</id>
61+
<build>
62+
<plugins>
63+
<plugin>
64+
<groupId>org.sonatype.plugins</groupId>
65+
<artifactId>nexus-staging-maven-plugin</artifactId>
66+
<version>1.6.13</version>
67+
<extensions>true</extensions>
68+
<configuration>
69+
<serverId>repository</serverId>
70+
<nexusUrl>https://s01.oss.sonatype.org/</nexusUrl>
71+
<autoReleaseAfterClose>true</autoReleaseAfterClose>
72+
</configuration>
73+
</plugin>
74+
</plugins>
75+
</build>
76+
</profile>
77+
</profiles>
78+
5879
<developers>
5980
<developer>
6081
<id>hohwille</id>
@@ -131,4 +152,4 @@
131152
<properties/>
132153
</developer>
133154
</developers>
134-
</project>
155+
</project>

0 commit comments

Comments
 (0)