Skip to content

publish

publish #42

Workflow file for this run

name: publish
on:
push:
branches:
- 'coatl'
paths:
- '.github/workflows/publish.yml'
- 'requirements/**'
- 'Dockerfile'
schedule:
- cron: '30 20 * * 1,5'
jobs:
tagger:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.tags.outputs.version }}
major_minor: ${{ steps.tags.outputs.major_minor }}
major: ${{ steps.tags.outputs.major }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Extract version number
id: tags
run: |
# Extract the Python version from the Dockerfile
VERSION=$(grep -oP 'devpi-server==\K[0-9]+\.[0-9]+\.[0-9]+' requirements/devpi.txt)
echo "VERSION=${VERSION}"
# Trim the version to the first two segments (major.minor)
MAJOR_MINOR=$(echo "$VERSION" | grep -oP '[0-9]+\.[0-9]+')
echo "MAJOR_MINOR=${MAJOR_MINOR}"
# Trim the version to the first segment (major)
MAJOR=$(echo "$MAJOR_MINOR" | grep -oP '^[0-9]+')
echo "MAJOR=${MAJOR}"
# Export the extracted version to GITHUB_OUTPUT
echo "version=${VERSION}" >> $GITHUB_OUTPUT
echo "major_minor=${MAJOR_MINOR}" >> $GITHUB_OUTPUT
echo "major=${MAJOR}" >> $GITHUB_OUTPUT
build:
needs: tagger
runs-on: ubuntu-latest
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ vars.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Log in to Quay
uses: docker/login-action@v3
with:
registry: quay.io
username: ${{ vars.QUAY_USERNAME }}
password: ${{ secrets.QUAY_ROBOT_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v6
with:
cache-from: type=gha
cache-to: type=gha,mode=max
platforms: linux/amd64,linux/arm64
provenance: false
push: true
tags: |
coatldev/devpi:${{ needs.tagger.outputs.version }}
coatldev/devpi:${{ needs.tagger.outputs.major_minor }}
coatldev/devpi:${{ needs.tagger.outputs.major }}
coatldev/devpi:latest
quay.io/coatldev/devpi:${{ needs.tagger.outputs.version }}
quay.io/coatldev/devpi:${{ needs.tagger.outputs.major_minor }}
quay.io/coatldev/devpi:${{ needs.tagger.outputs.major }}
quay.io/coatldev/devpi:latest