Skip to content

Commit

Permalink
BAH-4090 | Add. Workflow torelease artifacts on push of a tag
Browse files Browse the repository at this point in the history
  • Loading branch information
mohan-13 committed Aug 26, 2024
1 parent 53fccf7 commit 0db0010
Show file tree
Hide file tree
Showing 3 changed files with 58 additions and 2 deletions.
9 changes: 7 additions & 2 deletions .github/workflows/build_publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,13 @@ jobs:
run: |
sudo gem install compass -v 1.0.3
- 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 }}

44 changes: 44 additions & 0 deletions .github/workflows/release_deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
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: macos-14
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: Install Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '2.7'
bundler-cache: true
- name: Install compass
run: |
sudo gem install compass -v 1.0.3
- 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 @@ -154,6 +154,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 0db0010

Please sign in to comment.