forked from openmrs/openmrs-distro-referenceapplication
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #84 from larslemos/dev
Updated workflow for dev branch, deployment on dev server
- Loading branch information
Showing
1 changed file
with
67 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -117,3 +117,70 @@ jobs: | |
cache-to: type=gha,mode=max | ||
- name: Save image digest | ||
run: echo "::set-output name=image::${{ steps.build-and-push.output.digest }}" | ||
|
||
dev_server_status: | ||
if: github.ref == 'refs/heads/dev-deploy' | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Wait for 5 minutos - Let Images reflect on Docker Hub | ||
run: sleep 300 | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
|
||
- name: Copy files to /home/runner/ | ||
run: | | ||
ls -la -t | ||
cp -r $GITHUB_WORKSPACE/.ssh/ /home/runner/ | ||
- name: List contents of /home/runner/ | ||
run: ls -la /home/runner/ | ||
|
||
- name: webfactory/ssh-agent | ||
uses: webfactory/[email protected] | ||
with: | ||
ssh-private-key: ${{ secrets.LL_SSH_PRIVATE_KEY }} | ||
|
||
- name: Check SSH to remote OHRI Dev status | ||
run: | | ||
ssh-keygen -R 172.19.0.16 | ||
dev_server_connection_dev: | ||
runs-on: ubuntu-latest | ||
needs: dev_server_status | ||
steps: | ||
- name: SSH to remote OHRI Dev server | ||
run: | | ||
ssh -o StrictHostKeyChecking=no -T [email protected] -p 2216 -J [email protected] -p 2202 | ||
ls -la -t && \ | ||
cd /opt && \ | ||
ls -la -t | ||
dev_deploy: | ||
runs-on: ubuntu-latest | ||
needs: dev_server_status | ||
|
||
if: (github.event_name == 'push' || github.event.pull_request.merged) | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: webfactory/ssh-agent | ||
uses: webfactory/[email protected] | ||
|
||
with: | ||
ssh-private-key: ${{ secrets.LL_SSH_PRIVATE_KEY }} | ||
|
||
- name: SSH to remote OHRI Dev server via jump host | ||
run: | | ||
ssh -p 2216 \ | ||
-o "UserKnownHostsFile=/dev/null" \ | ||
-o "StrictHostKeyChecking=no" \ | ||
-o "ProxyCommand=ssh -o StrictHostKeyChecking=no -W %h:%p [email protected] -p 2202" \ | ||
[email protected] "\ | ||
cd /opt && \ | ||
docker compose -f docker-compose-ohri-dev.yml pull && \ | ||
docker compose -f docker-compose-ohri-dev.yml stop && \ | ||
docker compose -f docker-compose-ohri-dev.yml up -d" | ||