Skip to content

Commit ec41d45

Browse files
committed
feat: rename docker-publish.yml to publish-deploy.yml and add SSH deploy steps
1 parent 858337a commit ec41d45

File tree

2 files changed

+21
-31
lines changed

2 files changed

+21
-31
lines changed

.github/workflows/deployment.yaml

Lines changed: 0 additions & 29 deletions
This file was deleted.
Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
#
2-
name: Create and publish a Docker image
1+
name: Publish a Docker image / SSH Deploy
32

43
# Configures this workflow to run every time a change is pushed to the branch called `release`.
54
on:
@@ -60,3 +59,23 @@ jobs:
6059
subject-digest: ${{ steps.push.outputs.digest }}
6160
push-to-registry: true
6261

62+
SSH-Deploy:
63+
runs-on: ubuntu-latest
64+
needs: build-and-push-image
65+
steps:
66+
- name: executing remote ssh commands using password
67+
uses: appleboy/[email protected]
68+
with:
69+
host: ${{ secrets.SSH_HOST }}
70+
username: ${{ secrets.SSH_USERNAME }}
71+
password: ${{ secrets.SSH_PASSWORD }}
72+
port: ${{ secrets.SSH_PORT }}
73+
script: |
74+
IMAGE_ID=ghcr.io/${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
75+
docker pull $IMAGE_ID:latest
76+
docker stop codepoker-be
77+
docker rm codepoker-be
78+
docker run -d --name codepoker-be \
79+
-p ${{ secrets.SSH_PORT }}:${{ secrets.SSH_PORT }} \
80+
--restart=always \
81+
$IMAGE_ID:latest

0 commit comments

Comments
 (0)