Skip to content

feat(pyproject.toml): add bump-my-version for automatic version bumps #4

feat(pyproject.toml): add bump-my-version for automatic version bumps

feat(pyproject.toml): add bump-my-version for automatic version bumps #4

name: Publish to Docker
on:
push:
branches: ["main"]
tags:
- 'v*'
env:
REGISTRY: docker.io
IMAGE_NAME: ${{ github.repository }}
BUILD_PLATFORMS: linux/amd64,linux/arm64
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
platforms: ${{ env.BUILD_PLATFORMS }}
- name: Login to ${{ env.REGISTRY }}
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
# Extract metadata (tags, labels) for Docker
# https://github.com/docker/metadata-action
# output: edge,latest,1.2.3
- name: Extract Docker metadata
id: docker-meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
# TODO: edge
type=edge
# 1.2.3
type=semver,pattern={{version}}
- name: Build and push
id: build-and-push
uses: docker/build-push-action@v6
with:
context: .
tags: ${{ steps.docker-meta.outputs.tags }}
labels: ${{ steps.docker-meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
platforms: ${{ env.BUILD_PLATFORMS }}
push: true
build-args: |
VERSION=${{ fromJSON(steps.docker-meta.outputs.json).labels['org.opencontainers.image.version'] }}
REVISION=${{ fromJSON(steps.docker-meta.outputs.json).labels['org.opencontainers.image.revision'] }}