Skip to content

Add clear image metadata option #133

Add clear image metadata option

Add clear image metadata option #133

Workflow file for this run

---
name: release
on:
push:
tags:
- "[0-9]+.[0-9]+.[0-9]+"
pull_request:
branches:
- "master"
permissions:
contents: read
packages: write
jobs:
release:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: Set up Python
id: setup-python
uses: actions/setup-python@v3
with:
python-version: "3.10"
- name: Install dependencies
run: |
pip install -U pip
pip install wheel
- name: Build package
run: python setup.py sdist bdist_wheel
- name: Publish a Python distribution to PyPI
if: github.event_name != 'pull_request'
uses: pypa/[email protected]
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
skip_existing: true
docker:
needs: release
runs-on: ubuntu-22.04
strategy:
matrix:
python_version:
- "3.8"
- "3.9"
- "3.10"
- "3.11"
- "3.12"
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: "0"
- name: Set output on new tags
if: github.event_name != 'pull_request'
run: echo "REMOTECV_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: Set output on PR
if: github.event_name == 'pull_request'
run: echo "REMOTECV_VERSION=$(git describe --tags --abbrev=0)" >> $GITHUB_ENV
- name: Enable docker cache push
if: github.event_name != 'pull_request'
run: echo "CACHE_TO=type=registry,ref=ghcr.io/thumbor/remotecv:buildcache-${{ matrix.python_version }},mode=max" >> $GITHUB_ENV
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
- name: Login to GHCR
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Login to Quay.io
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
registry: quay.io
username: ${{ secrets.QUAY_IO_USERNAME }}
password: ${{ secrets.QUAY_IO_PASSWORD }}
- name: Login to Docker Hub
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
flavor: |
suffix=-py-${{ matrix.python_version }}
images: |
ghcr.io/thumbor/remotecv
quay.io/thumbor/remotecv
thumbororg/remotecv
tags: |
type=schedule
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=sha
- name: Build and push
uses: docker/build-push-action@v3
with:
context: ./docker
platforms: linux/amd64,linux/arm64
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=registry,ref=ghcr.io/thumbor/remotecv:buildcache-${{ matrix.python_version }}
cache-to: ${{ env.CACHE_TO }}
build-args: |
REMOTECV_VERSION=${{ env.REMOTECV_VERSION }}
PYTHON_VERSION=${{ matrix.python_version }}