Merge pull request #16 from talkincheap/draft #88
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 bot on hosting | |
on: | |
push: | |
branches: [production] | |
jobs: | |
update-src-folder: | |
name: 🪀 Update src folder with new files | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
sparse-checkout: src | |
- name: Setup SSH Key | |
uses: shimataro/ssh-key-action@v2 | |
with: | |
key: ${{ secrets.SSH_PRIVATE_KEY }} | |
known_hosts: unnecessary | |
- name: Adding Known Hosts | |
run: ssh-keyscan -p ${{ secrets.SSH_PORT }} -H ${{ secrets.SSH_HOST }} >> ~/.ssh/known_hosts | |
- name: Deploy with rsync | |
run: rsync -rvzP --delete -e "ssh -p ${{ secrets.SSH_PORT }}" src ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }}:home/xmnlz/vpitashka/ | |
- name: Run docker compose | |
uses: appleboy/ssh-action@master | |
with: | |
host: ${{ secrets.SSH_HOST }} | |
username: ${{ secrets.SSH_USER }} | |
key: ${{ secrets.SSH_PRIVATE_KEY }} | |
port: ${{ secrets.SSH_PORT }} | |
script: | | |
cd home/xmnlz/vpitashka/ | |
docker compose --env-file .env.production up -d --no-deps --build vpitashka |