Skip to content

Commit

Permalink
Create maven-publish.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
Murithijoshua authored Apr 7, 2024
1 parent 358175a commit f4b81d0
Showing 1 changed file with 68 additions and 0 deletions.
68 changes: 68 additions & 0 deletions .github/workflows/maven-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: deploy to prod 8600
on:
push:
branches: [ master, 2.x ]
jobs:
build:
name: deploying to 2.x instance
if: github.ref == 'refs/heads/2.x'
runs-on: ubuntu-latest
steps:
- name: executing remote connection
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
key: ${{ secrets.CICD_SECRET }}
port: ${{ secrets.PORT }}
command_timeout: 200m
script: |
cd /apps/github-workflows/bedmanagement-modules
sudo rm -rf openmrs-module-bedmanagement
sudo mkdir openmrs-module-bedmanagement
sudo chown -R cicd2:cicd2 openmrs-module-bedmanagement
git config --global --add safe.directory /apps/github-workflows/bedmanagement-modules/openmrs-module-bedmanagement
cd /apps/github-workflows/bedmanagement-modules/openmrs-module-bedmanagement
git clone -b 2.x https://github.com/palladiumkenya/openmrs-module-bedmanagement.git /apps/github-workflows/bedmanagement-modules/openmrs-module-bedmanagement
sudo chown -R cicd2:cicd2 /apps/github-workflows/bedmanagement-modules/openmrs-module-bedmanagement
git status
mvn license:format
sudo mvn clean install -DskipTests
sudo rm -rf /var/lib/OpenMRS/modules/bedmanagement-*.omod
sudo cp -r /apps/github-workflows/bedmanagement-modules/openmrs-module-bedmanagement/omod/target/bedmanagement-*.omod /var/lib/OpenMRS/modules/
sudo chown -R tomcat:tomcat /var/lib/OpenMRS/modules/
sudo chmod +r /var/lib/OpenMRS/modules/*.omod
sudo chmod 755 /var/lib/OpenMRS/modules/*.omod
sudo systemctl stop tomcat
sudo systemctl start tomcat
dev_server_deployment:
name: deploying to 3.x dev instance
if: github.ref == 'refs/heads/master'
runs-on: ubuntu-latest
steps:
- name: executing remote connection
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.CICD_HOST }}
username: ${{ secrets.CICD_USERNAME }}
key: ${{ secrets.CICD_SECRET }}
port: ${{ secrets.PORT }}
command_timeout: 200m
script: |
cd /apps/githubworkflows/bedmanagement-modules
sudo rm -rf openmrs-module-bedmanagement
sudo mkdir openmrs-module-bedmanagement
sudo chown -R cicd:cicd openmrs-module-bedmanagement
git config --global --add safe.directory /apps/githubworkflows/bedmanagement-modules/openmrs-module-bedmanagement
cd /apps/githubworkflows/bedmanagement-modules/openmrs-module-bedmanagement
git clone -b master https://github.com/palladiumkenya/openmrs-module-bedmanagement.git .
git status
mvn license:format
sudo mvn clean install -DskipTests
sudo rm -rf /var/lib/OpenMRS/modules/bedmanagement-*.omod
sudo cp -r /apps/githubworkflows/bedmanagement-modules/openmrs-module-bedmanagement/omod/target/bedmanagement-*.omod /var/lib/OpenMRS/modules/
sudo chown -R tomcat:tomcat /var/lib/OpenMRS/modules/
sudo chmod +r /var/lib/OpenMRS/modules/*.omod
sudo chmod 755 /var/lib/OpenMRS/modules/*.omod
sudo service tomcat9 restart

0 comments on commit f4b81d0

Please sign in to comment.