Skip to content

BAH-4008 | Refactor. Update global property for cdss URL (#15) #54

BAH-4008 | Refactor. Update global property for cdss URL (#15)

BAH-4008 | Refactor. Update global property for cdss URL (#15) #54

name: Build and Publish package
on:
push:
branches: [ main ]
workflow_dispatch:
jobs:
build-publish-package:
name: Build and Publish 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
- name: Cache Maven packages
uses: actions/cache@v3
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-m2
- name: Build and deploy with Maven
run: mvn --no-transfer-progress clean -U deploy
env:
NEXUS_USERNAME: ${{ secrets.NEXUS_USERNAME }}
NEXUS_PASSWORD: ${{ secrets.NEXUS_PASSWORD }}
trigger:
name: Trigger Build Workflow in Distro Bahmni
needs:
- build-publish-package
runs-on: ubuntu-latest
env:
ORG_NAME: Bahmni
REPOSITORY_NAME: openmrs-distro-bahmni
ENVIRONMENT: dev
steps:
- name: Create workflow_dispatch
run: |
trigger_result=$(curl -s -o trigger_response.txt -w "%{http_code}" -X POST -H "Accept: application/vnd.github.v3+json" -H 'authorization: Bearer ${{ secrets.BAHMNI_PAT }}' https://api.github.com/repos/${ORG_NAME}/${REPOSITORY_NAME}/actions/workflows/build_publish_openmrs.yml/dispatches -d '{"ref":"master","inputs":{}')
if [ $trigger_result == 204 ];then
echo "Trigger to $ORG_NAME/$REPOSITORY_NAME Success"
else
echo "Trigger to $ORG_NAME/$REPOSITORY_NAME Failed"
cat trigger_response.txt
exit 1
fi