Skip to content

Commit

Permalink
Merge pull request #84 from larslemos/dev
Browse files Browse the repository at this point in the history
Updated workflow for dev branch, deployment on dev server
  • Loading branch information
alaboso authored Aug 23, 2023
2 parents dc69715 + 8656593 commit 623ec37
Showing 1 changed file with 67 additions and 0 deletions.
67 changes: 67 additions & 0 deletions .github/workflows/ohri-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"

0 comments on commit 623ec37

Please sign in to comment.