Skip to content

Commit b818304

Browse files
authored
Merge pull request #17 from cuappdev/main
revert to appleboy #2
2 parents 34dd683 + 072a672 commit b818304

1 file changed

Lines changed: 11 additions & 20 deletions

File tree

.github/workflows/deploy-prod.yml

Lines changed: 11 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Docker Build & Push and Deploy to prod for eatery-blue-backend
1+
name: Docker Build & Push and Deploy to prod for eatery-prod
22

33
on:
44
push:
@@ -34,27 +34,18 @@ jobs:
3434
push: true
3535
tags: cornellappdev/eatery-prod:${{ steps.vars.outputs.sha_short }}
3636

37-
- name: Deploy with Native SSH
37+
- name: Remote SSH and Deploy
38+
uses: appleboy/ssh-action@v1.0.3
3839
env:
39-
PRIVATE_KEY: ${{ secrets.PROD_SERVER_KEY }}
40-
HOST: ${{ secrets.PROD_SERVER_HOST }}
41-
REMOTE_USER: ${{ secrets.SERVER_USERNAME }}
4240
IMAGE_TAG: ${{ steps.vars.outputs.sha_short }}
43-
run: |
44-
mkdir -p ~/.ssh
45-
chmod 700 ~/.ssh
46-
47-
# Safely write the key and strip any invisible Windows carriage returns
48-
echo "$PRIVATE_KEY" | tr -d '\r' > ~/.ssh/id_rsa
49-
chmod 600 ~/.ssh/id_rsa
50-
51-
ssh-keyscan -H "$HOST" >> ~/.ssh/known_hosts
52-
53-
ssh -v -o PubkeyAcceptedKeyTypes=+ssh-rsa -i ~/.ssh/id_rsa "$REMOTE_USER@$HOST" "
54-
export IMAGE_TAG=$IMAGE_TAG
41+
with:
42+
host: ${{ secrets.PROD_SERVER_HOST }}
43+
username: ${{ secrets.SERVER_USERNAME }}
44+
key: ${{ secrets.PROD_SERVER_KEY }}
45+
script: |
46+
export IMAGE_TAG=${{ steps.vars.outputs.sha_short }}
5547
cd docker-compose
5648
docker stack rm thestack
57-
sleep 20
49+
sleep 20s
5850
docker stack deploy -c docker-compose.yml thestack
59-
docker system prune -af
60-
"
51+
yes | docker system prune -a

0 commit comments

Comments
 (0)