Created a new job for the docker status #24
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
name: Deploy | |
on: | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
jobs: | |
deploy: | |
name: "Deploy to VPS" | |
runs-on: ubuntu-latest | |
steps: | |
- name: Configure SSH | |
run: | | |
mkdir -p ~/.ssh/ | |
echo "$SSH_PRIVATE_KEY" > ~/.ssh/deploy-key.pem | |
chmod 600 ~/.ssh/deploy-key.pem | |
cat >> ~/.ssh/config <<END | |
Host my-vps | |
HostName $SSH_IP | |
User $SSH_USER | |
IdentityFile ~/.ssh/deploy-key.pem | |
StrictHostKeyChecking no | |
END | |
env: | |
SSH_USER: ${{ secrets.SSH_USER }} | |
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }} | |
SSH_IP: ${{ secrets.SSH_IP }} | |
- name: Deploy site | |
run: | | |
ssh my-vps '~/redeploy-site.sh' | |
docker ps | |
- name: "Deployment Successful" | |
run: curl -s -X POST "${{ secrets.DISCORD_WEBHOOK }}" -d "content=🚀 Deployment Successful" | |
- name: "Deployment Failed" | |
if: failure() | |
run: curl -s -X POST "${{ secrets.DISCORD_WEBHOOK }}" -d "content=🚨 Deployment Failed" | |
status: | |
name: "Docker Status" | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check Containers | |
run: ssh my-vps 'docker ps' |