Skip to content

build!: Refactor dependencies and CI #4

build!: Refactor dependencies and CI

build!: Refactor dependencies and CI #4

Workflow file for this run

name: Build and Deploy
permissions:
contents: read
packages: write
on:
push:
tags:
- "v*.*.*"
jobs:
build:
name: Build and Push Docker images
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: |
ghcr.io/itsamirhn/bonbast-api:latest
ghcr.io/itsamirhn/bonbast-api:${{ github.ref_name }}
deploy:
name: Deploy API
runs-on: ubuntu-latest
needs:
- build
environment: production
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Deploy to server
uses: easingthemes/ssh-deploy@main
with:
SSH_PRIVATE_KEY: ${{ secrets.SSH_KEY }}
REMOTE_HOST: ${{ secrets.SSH_HOST }}
REMOTE_USER: ${{ secrets.SSH_USERNAME }}
SOURCE: docker-compose.yaml
SCRIPT_AFTER: |
TAG=${{ github.ref_name }} docker compose up -d