Skip to content

Commit

Permalink
BAH-4087 | Add. Workflow for release deploy (#157)
Browse files Browse the repository at this point in the history
  • Loading branch information
mohan-13 authored Aug 26, 2024
1 parent 56721e0 commit b837737
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 1 deletion.
8 changes: 7 additions & 1 deletion .github/workflows/build_publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,13 @@ jobs:
server-username: NEXUS_USERNAME
server-password: NEXUS_PASSWORD
- name: Build and deploy with Maven
run: ./mvnw --no-transfer-progress clean -U deploy
run: |
PROJECT_VERSION=$(./mvnw help:evaluate -Dexpression=project.version -q -DforceStdout)
if [[ "$PROJECT_VERSION" == *"-SNAPSHOT" ]]; then
./mvnw --no-transfer-progress clean -U deploy
else
echo "❌ The current push is for release. So skipping build."
fi
env:
NEXUS_USERNAME: ${{ secrets.NEXUS_USERNAME }}
NEXUS_PASSWORD: ${{ secrets.NEXUS_PASSWORD }}
37 changes: 37 additions & 0 deletions .github/workflows/release_deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Build and Release package
on:
push:
tags:
- '[0-9]+.[0-9]+.[0-9]+'

jobs:
build-release-package:
name: Build and Release package
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
server-id: nexus-sonatype
server-username: NEXUS_USERNAME
server-password: NEXUS_PASSWORD
gpg-private-key: ${{ secrets.BAHMNI_INFRA_GPG_KEY }}
- name: Compare Git tag with Maven version
run: |
export GIT_TAG=${GITHUB_REF#refs/tags/}
PROJECT_VERSION=$(./mvnw help:evaluate -Dexpression=project.version -q -DforceStdout)
if [ "$PROJECT_VERSION" != "$GIT_TAG" ]; then
echo "❌ The Git tag ($GIT_TAG) does not match the Maven version ($PROJECT_VERSION)."
exit 1
else
echo "✅ The Git tag matches the Maven version."
fi
- name: Build and deploy with Maven
run: ./mvnw --no-transfer-progress clean -U deploy -DperformRelease=true
env:
NEXUS_USERNAME: ${{ secrets.NEXUS_USERNAME }}
NEXUS_PASSWORD: ${{ secrets.NEXUS_PASSWORD }}
GPG_PASSPHRASE: ${{ secrets.BAHMNI_INFRA_GPG_PASSPHRASE }}
7 changes: 7 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,13 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>1.6</version>
<configuration>
<!-- Prevent gpg from using pinentry programs -->
<gpgArguments>
<arg>--pinentry-mode</arg>
<arg>loopback</arg>
</gpgArguments>
</configuration>
<executions>
<execution>
<id>sign-artifacts</id>
Expand Down

0 comments on commit b837737

Please sign in to comment.