Skip to content

Commit

Permalink
add automatic deploy step to otc workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
fatemeh-i committed Mar 6, 2024
1 parent a0203a4 commit c3e9e28
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion .github/workflows/dev-otc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ jobs:
env:
TAG: otc-dev
run: docker-compose -f docker-compose-otc.build.yml build
publish:
name: push docker images to ghcr
runs-on: ubuntu-20.04
needs: build
steps:
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
Expand All @@ -39,4 +44,18 @@ jobs:
- name: Push images to GitHub Container Registry
env:
TAG: otc-dev
run: docker-compose -f docker-compose-otc.build.yml push
run: docker-compose -f docker-compose-otc.build.yml push
deploy:
name: deploy docker-compose on remote host
runs-on: ubuntu-20.04
needs: publish
steps:
- name: set ssh keys
run: |
install -m 600 -D /dev/null ~/.ssh/id_rsa
echo "${{secrets.SSH_PRIVATE_KEY}}" > ~/.ssh/id_rsa
ssh-keyscan -H ${{secrets.SSH_HOST}} >~/.ssh/known_hosts
- name: pull docker images in dest server
run: |
ssh ${{secrets.SSH_USER}}@${{secrets.SSH_HOST}} "cd ${{secrets.WORK_DIR}} && docker-compose -f docker-compose-otc.yml -f docker-compose-otc.override.yml -f docker-compose-otc.build.yml -f docker-compose-otc.local.yml up --build -d && exit "

0 comments on commit c3e9e28

Please sign in to comment.