This repository has been archived on 2023-05-31. You can view files and clone it, but cannot push or open issues or pull requests.
python-blog/.github/workflows/publish.yaml

40 lines
1.1 KiB
YAML
Raw Normal View History

2022-09-28 01:04:44 +02:00
name: Build, publish & deploy
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
2022-09-28 01:00:08 +02:00
cache-from: type=registry,ref=crocmagnon/blog:latest
cache-to: type=inline
build-args: |
2022-09-27 23:38:39 +02:00
POETRY_OPTIONS=--no-dev
2022-09-28 01:04:01 +02:00
deploy:
name: Deploy new image
runs-on: ubuntu-latest
needs: [push_to_registry]
steps:
2022-09-28 00:57:24 +02:00
- name: Deploy
2022-09-28 01:16:05 +02:00
run: |
TEMP=$(mktemp)
echo "${{ secrets.DEPLOY_KEY }}" > $TEMP
2022-09-28 01:24:48 +02:00
ssh -o StrictHostKeyChecking=no -i $TEMP -p ${{ secrets.DEPLOY_PORT }} ${{ secrets.DEPLOY_USERNAME }}@${{ secrets.DEPLOY_HOST }} /mnt/data/blog/update
2022-09-28 01:31:35 +02:00
- name: Check
run: |
curl --fail https://gabnotes.org