Skip to content

Commit

Permalink
Implementation of #813: Automated Release Process (#900)
Browse files Browse the repository at this point in the history
  • Loading branch information
ahmedagdmoun authored Oct 10, 2022
1 parent c6befca commit d72d893
Show file tree
Hide file tree
Showing 3 changed files with 89 additions and 2 deletions.
65 changes: 65 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Release

# Runs manually
on:
workflow_dispatch

jobs:
release:
name: Release on Sonatype OSS
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive

- name: Set up Apache Maven Central
uses: actions/setup-java@v3
with:
java-version: 11
distribution: 'temurin'
cache: 'maven'
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }} # Value of the GPG private key to import
gpg-passphrase: GPG_PASSPHRASE # env variable for GPG private key passphrase

- name: Publish to Apache Maven Central
run: |
maven_config="$(cat .mvn/maven.config)"
current_version="${maven_config/#*-Drevision=}"
current_version="${current_version/ */}"
next_version="${current_version/-SNAPSHOT/}"
sed -i "s/${current_version}/${next_version}/" .mvn/maven.config
git config --global user.email ${{ secrets.BUILD_USER_EMAIL }}
git config --global user.name ${{ secrets.BUILD_USER }}
git add -f .mvn/maven.config
git commit -m "set release version to ${next_version}"
git tag -a "release/${next_version}" -m "tagged version ${next_version}"
mvn --settings .mvn/settings.xml deploy -Pdeploy -Dgpg.pin.entry.mode=loopback -Dgpg.passphrase=${{ secrets.GPG_PASSPHRASE }}
env:
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }}
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}

- name: set next version & create gitHub release
run: |
maven_config="$(cat .mvn/maven.config)"
current_version="${maven_config/#*-Drevision=}"
current_version="${current_version/ */}"
current_segment="${current_version/*./}"
(( next_segment=${current_segment}+1 ))
while [ ${#next_segment} -ne 3 ]; do next_segment="0${next_segment}"; done
next_version="${current_version%.*}.${next_segment}-SNAPSHOT"
sed -i "s/${current_version}/${next_version}/" .mvn/maven.config
git add -f .mvn/maven.config
git commit -m "set next version to ${next_version}"
git push
git push --tags
noDotVersion="${current_version//.}"
gh release create "release/${current_version}" --title "${current_version}" --notes "# Download
https://repo1.maven.org/maven2/com/devonfw/tools/ide/devonfw-ide-scripts/${old_version}/devonfw-ide-scripts-${current_version}.tar.gz
# Changes
https://github.com/devonfw/ide/blob/master/CHANGELOG.asciidoc#${noDotVersion}"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1 change: 1 addition & 0 deletions eclipse-m2e/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
</parent>
<artifactId>devonfw-ide-eclipse-m2e</artifactId>
<packaging>jar</packaging>
<version>dev-SNAPSHOT</version>
<name>${project.artifactId}</name>
<description>Maven example project to trigger/enforce the installation of m2e plugins</description>

Expand Down
25 changes: 23 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.devonfw</groupId>
<artifactId>maven-parent</artifactId>
<version>9</version>
<version>11</version>
</parent>
<groupId>com.devonfw.tools.ide.dev</groupId>
<artifactId>devonfw-ide</artifactId>
Expand Down Expand Up @@ -55,6 +55,27 @@
</plugins>
</build>

<profiles>
<profile>
<id>deploy</id>
<build>
<plugins>
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>1.6.13</version>
<extensions>true</extensions>
<configuration>
<serverId>repository</serverId>
<nexusUrl>https://s01.oss.sonatype.org/</nexusUrl>
<autoReleaseAfterClose>true</autoReleaseAfterClose>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>

<developers>
<developer>
<id>hohwille</id>
Expand Down Expand Up @@ -131,4 +152,4 @@
<properties/>
</developer>
</developers>
</project>
</project>

0 comments on commit d72d893

Please sign in to comment.