34 lines
974 B
YAML
34 lines
974 B
YAML
name: Publish Docker image
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
|
|
jobs:
|
|
push_to_registry:
|
|
name: Push Docker image to Docker Hub
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Log in to Docker Hub
|
|
uses: docker/login-action@v2
|
|
with:
|
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
- name: Build and push Docker image
|
|
uses: docker/build-push-action@v3
|
|
with:
|
|
push: true
|
|
tags: crocmagnon/blog:latest
|
|
cache-from: type=registry,ref=crocmagnon/blog:latest
|
|
cache-to: type=inline
|
|
build-args: |
|
|
POETRY_OPTIONS=--no-dev
|
|
- name: Deploy
|
|
uses: appleboy/ssh-action@master
|
|
with:
|
|
host: ${{ secrets.DEPLOY_HOST }}
|
|
username: ${{ secrets.DEPLOY_USERNAME }}
|
|
key: ${{ secrets.DEPLOY_KEY }}
|
|
port: ${{ secrets.DEPLOY_PORT }}
|
|
script: /mnt/data/blog/update
|