Skip to content

deploy

deploy #17

Workflow file for this run

name: deploy
on:
workflow_run:
workflows: [release]
branches: [main]
types:
- completed
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup SSH
env:
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
SSH_KNOWN_HOSTS: ${{ secrets.SSH_KNOWN_HOSTS }}
run: |
mkdir -p ~/.ssh/
echo "$SSH_PRIVATE_KEY" > ~/.ssh/deploy_key
chmod 600 ~/.ssh/deploy_key
echo "$SSH_KNOWN_HOSTS" > ~/.ssh/known_hosts
- name: Restart Application
env:
SSH_USER: ${{ secrets.SSH_USER }}
VPS_HOST: ${{ secrets.VPS_HOST }}
SSH_PORT: ${{ secrets.SSH_PORT }}
ENV: ${{ secrets.ENVIRONMENT }}
TOKEN: ${{ secrets.PRODUCTION_TOKEN }}
run: |
ssh -o StrictHostKeyChecking=no -i ~/.ssh/deploy_key $SSH_USER@$VPS_HOST -p $SSH_PORT \
'docker pull ghcr.io/t1nyb0x/discord-twitter-embed-rx:latest && \
docker run -d --env $ENV --env $TOKEN ghcr.io/t1nyb0x/discord-twitter-embed-rx:latest'