Skip to content

Workflow file for this run

name: Build and Push Docker Image
on:
push:
branches:
- main
jobs:
build-and-push:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and push Docker image
uses: docker/build-push-action@v2
with:
context: ./backend
push: true
tags: franciszekszeptycki/ecommerce-tbeitw:latest
deploy:
runs-on: ubuntu-latest
needs: build-and-push
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up SSH
uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
- name: Create SSH private key file
run: |
echo "$SSH_PRIVATE_KEY" > ./ssh-private-key
shell: bash
- name: Run deploy.sh
run: |
ssh -o StrictHostKeyChecking=no -i ./ssh-private-key ${{ secrets.USER }}@${{ secrets.HOST }} '~/deploy.sh'
shell: bash