Skip to content

Commit

Permalink
Merge pull request #589 from catenax-ng/feature/TRI-1468-enable-full-…
Browse files Browse the repository at this point in the history
…library-release

Feature/tri 1468 enable full library release
  • Loading branch information
ds-jhartmann authored Oct 17, 2023
2 parents 80dc532 + e413b93 commit 428a621
Show file tree
Hide file tree
Showing 5 changed files with 173 additions and 1 deletion.
61 changes: 61 additions & 0 deletions .github/workflows/dependencies-update.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: "Update DEPENDENCIES file"

on:
push:
branches:
- main

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'

- name: Cache maven packages
uses: actions/cache@v3
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2

- name: Generate Dependencies file
run: mvn org.eclipse.dash:license-tool-plugin:license-check -Ddash.summary=DEPENDENCIES

- name: Check if file was changed
run: |
if git diff --name-only ${{ github.base_ref }}...${{ github.sha }} | grep -e 'DEPENDENCIES'; then
echo "The file was changed"
echo "was_file_changed=true" >> "$GITHUB_ENV"
git
else
echo "The file was not changed"
echo "was_file_changed=false" >> "$GITHUB_ENV"
fi
- name: Configure Git
if: ${{ env.was_file_changed }} == 'true'
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "$GITHUB_ACTOR@users.noreply.github.com"
- name: Create pull request
if: ${{ env.was_file_changed }} == 'true'
uses: peter-evans/create-pull-request@v5
with:
add-paths: |
DEPENDENCIES
token: ${{ secrets.GITHUB_TOKEN }}
branch: chore/update-DEPENDENCIES
commit-message: "chore(dependencies): Update DEPENDENCIES"
delete-branch: true
title: Update DEPENDENCIES
body: |
This PR updates the DEPENDENCIES
2 changes: 2 additions & 0 deletions .github/workflows/maven-deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -88,3 +88,5 @@ jobs:
fi
echo "Publishing Version $VERSION to Sonatype Repository $REPOSITORY_URL"
mvn -s $HOME/.m2/settings.xml --batch-mode gpg:sign-and-deploy-file -Dgpg.passphrase="${{ secrets.ORG_GPG_PASSPHRASE }}" -Durl=$REPOSITORY_URL -DrepositoryId=ossrh -Dfile=irs-registry-client/target/irs-registry-client-$VERSION-jar-with-dependencies.jar -DgroupId=org.eclipse.tractusx.irs -DartifactId=irs-registry-client -Dversion=$VERSION -Dpackaging=jar
mvn -s $HOME/.m2/settings.xml --batch-mode gpg:sign-and-deploy-file -Dgpg.passphrase="${{ secrets.ORG_GPG_PASSPHRASE }}" -Durl=$REPOSITORY_URL -DrepositoryId=ossrh -Dfile=irs-registry-client/target/irs-registry-client-$VERSION-sources.jar -Dclassifier=sources -DgroupId=org.eclipse.tractusx.irs -DartifactId=irs-registry-client -Dversion=$VERSION -Dpackaging=jar
mvn -s $HOME/.m2/settings.xml --batch-mode gpg:sign-and-deploy-file -Dgpg.passphrase="${{ secrets.ORG_GPG_PASSPHRASE }}" -Durl=$REPOSITORY_URL -DrepositoryId=ossrh -Dfile=irs-registry-client/target/irs-registry-client-$VERSION-javadoc.jar -Dclassifier=javadoc -DgroupId=org.eclipse.tractusx.irs -DartifactId=irs-registry-client -Dversion=$VERSION -Dpackaging=jar
83 changes: 83 additions & 0 deletions .github/workflows/update-registry-library.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
name: Update irs-registry-client Version

on:
workflow_dispatch:
inputs:
version-type:
type: choice
description: Type of version increment
required: true
options:
- 'major'
- 'minor'
- 'path'
is-release-version:
type: boolean
required: true
default: false
description: Select this if you want to create a release version (x.x.x) instead of a SNAPSHOT.

jobs:
open-pr-with-version-update:
name: "Open a Pull Request with the updated version of irs-registry-client."
runs-on: ubuntu-latest
needs:
- validate-input-version
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'

- name: Create new version
env:
TYPE: ${{ inputs.version-type }}
IS_RELEASE_VERSION: ${{ inputs.is-release-version }}
run: |
CURRENT_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout -pl irs-registry-client)
IFS='.' read -ra version_parts <<<"$CURRENT_VERSION"
major="${version_parts[0]}"
minor="${version_parts[1]}"
patch="${version_parts[2]}"
# Increment the version based on the increment type
if [ "$TYPE" == "major" ]; then
major=$((major + 1))
minor=0
patch=0
elif [ "$TYPE" == "minor" ]; then
minor=$((minor + 1))
patch=0
elif [ "$TYPE" == "patch" ]; then
patch=$((patch + 1))
else
echo "Invalid increment type. Use 'major', 'minor', or 'patch'."
exit 1
fi
new_version="${major}.${minor}.${patch}-SNAPSHOT"
if [ $IS_RELEASE_VERSION = 'true' ]; then
new_version="${major}.${minor}.${patch}"
fi
echo "$new_version"
- name: Update irs-registry-client version
env:
VERSION: ${{ inputs.next-version }}
run: |-
sed -i -e 's#<irs-registry-client\.version>.*</irs-registry-client\.version>#<irs-registry-client\.version>'$VERSION'</irs-registry-client\.version>#g' pom.xml
- name: Create PR for irs-registry-client version update
uses: peter-evans/create-pull-request@v5
env:
VERSION: ${{ inputs.next-version }}
with:
commit-message: "chore(dependencies): Update irs-registry-client to $VERSION"
branch: chore/update-irs-registry-client-$VERSION
base: main
delete-branch: true
title: Update irs-registry-client to $VERSION
body: |
This PR updates the irs-registry-client version to $VERSION.
26 changes: 26 additions & 0 deletions irs-registry-client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,32 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.3.0</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.2.0</version>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
</sonar.coverage.jacoco.xmlReportPaths>

<!-- IRS Registry Client Library -->
<irs-registry-client.version>1.3.1-SNAPSHOT</irs-registry-client.version>
<irs-registry-client.version>1.3.1</irs-registry-client.version>

<!-- Dependencies -->
<springboot.version>3.1.4</springboot.version>
Expand Down

0 comments on commit 428a621

Please sign in to comment.