Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update cicd_process.yml #33

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 46 additions & 9 deletions .github/workflows/cicd_process.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
name: deploy to prod 8600
name: Test Deployments
on:
push:
branches: [ master ]
branches: [ master, 2.x ]
jobs:

build:
name: Deploy
name: deploying to 2.x instance
if: github.ref == 'refs/heads/2.x'
runs-on: ubuntu-latest
steps:
- name: executing remote connection
Expand All @@ -17,15 +17,52 @@ jobs:
port: ${{ secrets.PORT }}
command_timeout: 200m
script: |
git config --global --add safe.directory /apps/github-workflows/kenyaemr-modules/openmrs-module-kenyaui
cd /apps/github-workflows/kenyaemr-modules
sudo rm -rf openmrs-module-kenyaui
sudo mkdir openmrs-module-kenyaui
sudo chown -R cicd2:cicd2 openmrs-module-kenyaui
git config --global --add safe.directory /apps/github-workflows/kenyaemr-modules/openmrs-module-kenyaui
cd /apps/github-workflows/kenyaemr-modules/openmrs-module-kenyaui
git pull origin master
git clone -b 2.x https://github.com/palladiumkenya/openmrs-module-kenyaui.git /apps/github-workflows/kenyaemr-modules/openmrs-module-kenyaui
sudo chown -R cicd2:cicd2 /apps/github-workflows/kenyaemr-modules/openmrs-module-kenyaui
git status
mvn license:format
sudo mvn clean install -DskipTests
sudo rm -rf /var/lib/OpenMRS/modules/kenyaui-*.omod
sudo cp /apps/github-workflows/kenyaemr-modules/openmrs-module-kenyaui/omod/target/kenyaui-*.omod /var/lib/OpenMRS/modules/
sudo cp -r /apps/github-workflows/kenyaemr-modules/openmrs-module-kenyaui/omod/target/kenyaui-*.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/kenyaemr-modules
sudo rm -rf openmrs-module-kenyaui
sudo mkdir openmrs-module-kenyaui
sudo chown -R cicd:cicd openmrs-module-kenyaui
git config --global --add safe.directory /apps/githubworkflows/kenyaemr-modules/openmrs-module-kenyaui
cd /apps/githubworkflows/kenyaemr-modules/openmrs-module-kenyaui
git clone -b master https://github.com/palladiumkenya/openmrs-module-kenyaui.git .
git status
mvn license:format
sudo mvn clean install -DskipTests
sudo rm -rf /var/lib/OpenMRS/modules/kenyaui*.omod
sudo cp -r /apps/githubworkflows/kenyaemr-modules/openmrs-module-kenyaui/omod/target/kenyaui-*.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

sudo service tomcat9 restart