mirror of
https://github.com/mwisnowski/mtg_python_deckbuilder.git
synced 2025-09-22 04:50:46 +02:00
71 lines
2.1 KiB
YAML
71 lines
2.1 KiB
YAML
name: Publish Docker image to Docker Hub
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- 'v*'
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
docker:
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: read
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Prepare release notes from template
|
|
id: notes
|
|
shell: bash
|
|
run: |
|
|
VERSION_REF="${GITHUB_REF##*/}" # e.g. v1.2.3
|
|
TEMPLATE="RELEASE_NOTES_TEMPLATE.md"
|
|
if [ -f "$TEMPLATE" ]; then
|
|
sed "s/\${VERSION}/${VERSION_REF}/g" "$TEMPLATE" > RELEASE_NOTES.md
|
|
else
|
|
echo "# MTG Python Deckbuilder ${VERSION_REF}" > RELEASE_NOTES.md
|
|
echo >> RELEASE_NOTES.md
|
|
echo "Automated release." >> RELEASE_NOTES.md
|
|
fi
|
|
# Escape newlines for label usage
|
|
DESC=$(awk 'BEGIN{ORS="\\n"} {print}' RELEASE_NOTES.md)
|
|
echo "desc=$DESC" >> $GITHUB_OUTPUT
|
|
|
|
- name: Set up QEMU
|
|
uses: docker/setup-qemu-action@v3
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Docker Hub login
|
|
uses: docker/login-action@v3
|
|
with:
|
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
|
|
- name: Extract Docker metadata
|
|
id: meta
|
|
uses: docker/metadata-action@v5
|
|
with:
|
|
images: |
|
|
mwisnowski/mtg-python-deckbuilder
|
|
tags: |
|
|
type=semver,pattern={{version}}
|
|
type=semver,pattern={{major}}.{{minor}}
|
|
type=raw,value=latest
|
|
labels: |
|
|
org.opencontainers.image.title=MTG Python Deckbuilder
|
|
org.opencontainers.image.version=${{ github.ref_name }}
|
|
org.opencontainers.image.description=${{ steps.notes.outputs.desc }}
|
|
|
|
- name: Build and push
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
context: .
|
|
file: ./Dockerfile
|
|
push: true
|
|
platforms: linux/amd64,linux/arm64
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
labels: ${{ steps.meta.outputs.labels }}
|