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

51 lines
1.5 KiB
YAML
Raw Normal View History

2022-09-28 01:04:44 +02:00
name: Build, publish & deploy
on:
push:
branches:
- master
jobs:
2022-09-28 01:57:19 +02:00
tests:
2022-10-10 23:14:06 +02:00
uses: ./.github/workflows/test.yaml
push_to_registry:
name: Push Docker image to Docker Hub
runs-on: ubuntu-latest
2022-09-28 01:57:19 +02:00
needs: [tests]
steps:
2022-10-10 23:21:49 +02:00
- name: Checkout
uses: actions/checkout@v3
- 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
2022-09-28 01:31:43 +02:00
platforms: linux/amd64
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
2022-09-28 01:45:08 +02:00
uses: nick-fields/retry@v2
with:
timeout_seconds: 30
max_attempts: 5
retry_wait_seconds: 2
2022-09-28 01:46:52 +02:00
warning_on_retry: false
2022-09-28 01:48:04 +02:00
command: curl -sSL --fail -m 10 https://gabnotes.org > /dev/null