Deploy to Production #7
This file contains hidden or 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 to Production | |
| on: | |
| workflow_run: | |
| workflows: ["Build and Push"] | |
| types: | |
| - completed | |
| branches: | |
| - main | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| # Запускаємо ТІЛЬКИ якщо збірка пройшла успішно | |
| if: ${{ github.event.workflow_run.conclusion == 'success' }} | |
| env: | |
| SERVER_HOST: ${{ secrets.SERVER_HOST }} | |
| SERVER_USER: ${{ secrets.SERVER_USER }} | |
| SERVER_SSH_KEY: ${{ secrets.SERVER_SSH_KEY }} | |
| steps: | |
| - name: Execute SSH deployment script | |
| uses: appleboy/ssh-action@v1.0.3 | |
| with: | |
| host: ${{ env.SERVER_HOST }} | |
| username: ${{ env.SERVER_USER }} | |
| key: ${{ env.SERVER_SSH_KEY }} | |
| script: | | |
| cd ~/SEROTONIN_SCRIPT | |
| git pull origin main | |
| bash scripts/deploy.sh |