Merge pull request #22 from SoftBananas/ci-cd #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: | |
push: | |
branches: [ main-banana ] | |
jobs: | |
push_to_registry: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out the repo | |
uses: actions/checkout@v2 | |
- name: Log in to Docker Hub | |
uses: docker/login-action@v3.0.0 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
server_update: | |
needs: push_to_registry | |
name: Update server by ssh | |
runs-on: ubuntu-latest | |
steps: | |
- name: Connect and run script | |
uses: SoftBananas/ssh-action@v1.0.3 | |
with: | |
host: ${{ secrets.SERVER_HOST }} | |
port: ${{ secrets.SERVER_PORT }} | |
username: ${{ secrets.USERNAME }} | |
password: ${{ secrets.PASSWORD }} | |
script_stop: true | |
script: bash scripts/deploy.sh |