47 lines
1.3 KiB
YAML
47 lines
1.3 KiB
YAML
name: Build and push docker image and deploy
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
|
|
jobs:
|
|
build_and_push:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Log in to Github Container registry
|
|
uses: docker/login-action@v2
|
|
with:
|
|
registry: ghcr.io
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.DOCKER_REGISTRY_TOKEN }}
|
|
|
|
- name: Build and push Docker image
|
|
uses: docker/build-push-action@v4
|
|
with:
|
|
context: .
|
|
push: true
|
|
tags: ghcr.io/${{ github.actor }}/skyjo-fe:latest
|
|
|
|
deploy:
|
|
needs: build_and_push
|
|
if: ${{ success() }}
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- uses: astappiev/docker-compose-remote-action@master
|
|
name: Docker-Compose Remote Deployment
|
|
with:
|
|
ssh_host: ${{ secrets.DEPLOY_HOST }}
|
|
ssh_user: ${{ secrets.DEPLOY_USER }}
|
|
ssh_private_key: ${{ secrets.DEPLOY_KEY }}
|
|
ssh_host_public_key: ${{ secrets.DEPLOY_PUBLIC_KEY }}
|
|
docker_compose_prefix: skyjo-fe
|
|
workspace: ~/deployments/voltvector-be
|
|
container_registry: ghcr.io
|
|
container_registry_username: ${{ github.actor }}
|
|
container_registry_password: ${{ secrets.DOCKER_REGISTRY_TOKEN }}
|