Deploy #7
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: | |
workflow_dispatch: | |
push: | |
branches: [ main ] | |
jobs: | |
deploy: | |
name: Deploy application | |
runs-on: ubuntu-latest | |
steps: | |
- name: Prepare SSH | |
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 latest | |
run: | | |
ssh ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }} "cd muckraker && git pull origin main --rebase" | |
echo "Successfully pulled repo" | |
- name: Restart container | |
run: | | |
ssh ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }} "cd muckraker && docker compose stop && docker compose up --build -d" | |
echo "Successfully restarted container" | |