Skip to content

Merge pull request #23 from SoftBananas/ci-cd #8

Merge pull request #23 from SoftBananas/ci-cd

Merge pull request #23 from SoftBananas/ci-cd #8

Workflow file for this run

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 }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5.5.1
with:
images: ${{ secrets.DOCKER_USERNAME }}/${{ secrets.DOCKER_REPO_NAME }}
tags: latest
labels: latest
- name: Build and push Docker image
uses: docker/build-push-action@v5.1.0
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
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