46 lines
1.3 KiB
YAML
46 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: TapTap21/docker-remote-deployment-action@v1.1
|
|
name: Docker-Compose Remote Deployment
|
|
with:
|
|
remote_docker_host: ${{ secrets.DEPLOY_HOST }}
|
|
ssh_private_key: ${{ secrets.DEPLOY_KEY }}
|
|
ssh_public_key: ${{ secrets.DEPLOY_PUBLIC_KEY }}
|
|
stack_file_name: docker-compose.yml
|
|
docker_login_password: ${{ secrets.DOCKER_REGISTRY_TOKEN }}
|
|
docker_login_user: ${{ github.actor }}
|
|
docker_login_registry: ghcr.io
|
|
args: -p skyjo-fe up -d
|