👷 Prepare docker workflow for versioned releases

This commit is contained in:
Luke Vella 2023-02-06 19:30:30 +00:00
parent f0eabd82c3
commit 8465cfe6c2

View file

@ -1,8 +1,8 @@
name: Build and publish Docker image
on:
workflow_dispatch:
schedule:
- cron: "0 6 * * 1" # Every Monday at 6:00am UTC
push:
tags:
- "v*"
jobs:
publish:
@ -19,6 +19,16 @@ jobs:
id: buildx
uses: docker/setup-buildx-action@v2
- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: |
${{ secrets.DOCKER_NAMESPACE }}/rallly
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
@ -26,12 +36,11 @@ jobs:
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Build and publish image
uses: docker/build-push-action@v3
uses: docker/build-push-action@v4
with:
platforms: linux/arm64,linux/amd64
push: true
cache-from: type=gha
cache-to: type=gha,mode=max
tags: |
${{ secrets.DOCKER_NAMESPACE }}/rallly:latest
${{ secrets.DOCKER_NAMESPACE }}/rallly:${{ github.sha }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}