Robohash/.github/workflows/docker-publish.yml
e1ven 0b241447a5 Update Robohash for PyPI republishing
Some users have asked for an updated version in PyPI, so I'm doing some minor cleanup.
No real functionality changes, just modernizing things that would be considered more
standard 10+ years after this code was written.

- Added note about maintenance mode in README
- Cleaned up Python 3 compatibility (removed Python 2 support)
- Added minimal test for image consistency
- Added Docker image + GitHub workflow to build/publish it
- Fixed some minor bugs and improved error handling
- Added better CLI help text

The project is now officially in maintenance mode as noted in the README.
2025-03-15 16:30:01 -04:00

52 lines
1.3 KiB
YAML

name: Build and Publish Docker Image
on:
push:
# Publish when tags are pushed
tags:
- '*'
env:
REGISTRY: ghcr.io
# github.repository as <account>/<repo>
IMAGE_NAME: ${{ github.repository }}
jobs:
build-and-push-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
# Login to GitHub Container Registry
- name: Log in to the Container registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# Extract metadata for Docker
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=ref,event=tag
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
# Build and push Docker image
- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}