2023-03-25 20:24:12 +01:00
|
|
|
name: Test, build, publish & deploy
|
|
|
|
|
|
|
|
on:
|
|
|
|
workflow_dispatch:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- master
|
|
|
|
|
|
|
|
permissions:
|
|
|
|
contents: read
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
tests:
|
2023-03-25 21:21:07 +01:00
|
|
|
name: Test
|
2023-03-25 20:24:12 +01:00
|
|
|
uses: ./.github/workflows/test.yaml
|
|
|
|
push_to_registry:
|
|
|
|
name: Push Docker image to Docker Hub
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
needs: [tests]
|
|
|
|
steps:
|
|
|
|
- name: Checkout
|
2023-09-04 20:34:54 +02:00
|
|
|
uses: actions/checkout@v4
|
2023-03-25 20:24:12 +01:00
|
|
|
- name: Log in to Docker Hub
|
2023-09-18 20:44:39 +02:00
|
|
|
uses: docker/login-action@v3
|
2023-03-25 20:24:12 +01:00
|
|
|
with:
|
|
|
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
|
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
|
|
- name: Build and push Docker image
|
2024-06-17 20:10:17 +02:00
|
|
|
uses: docker/build-push-action@v6
|
2023-03-25 20:24:12 +01:00
|
|
|
with:
|
|
|
|
context: .
|
|
|
|
push: true
|
|
|
|
tags: crocmagnon/checkout:latest
|
|
|
|
cache-from: type=registry,ref=crocmagnon/checkout:latest
|
|
|
|
cache-to: type=inline
|
|
|
|
platforms: linux/amd64
|
|
|
|
deploy:
|
|
|
|
name: Deploy new image
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
needs: [push_to_registry]
|
|
|
|
steps:
|
|
|
|
- name: Deploy
|
|
|
|
run: |
|
|
|
|
TEMP=$(mktemp)
|
|
|
|
echo "${{ secrets.DEPLOY_KEY }}" > $TEMP
|
|
|
|
ssh -o StrictHostKeyChecking=no -i $TEMP -p ${{ secrets.DEPLOY_PORT }} ${{ secrets.DEPLOY_USERNAME }}@${{ secrets.DEPLOY_HOST }} /mnt/data/checkout/update
|
|
|
|
- name: Check
|
2024-02-05 19:53:26 +01:00
|
|
|
uses: nick-fields/retry@v3
|
2023-03-25 20:24:12 +01:00
|
|
|
with:
|
|
|
|
timeout_seconds: 30
|
|
|
|
max_attempts: 5
|
|
|
|
retry_wait_seconds: 2
|
|
|
|
warning_on_retry: false
|
2023-03-25 21:06:04 +01:00
|
|
|
command: curl -sSL --fail -m 10 https://checkout.augendre.info/ping/ | grep ${GITHUB_SHA::7} > /dev/null
|