Skip to content

add tags to docker images and cleanup workflow #25

add tags to docker images and cleanup workflow

add tags to docker images and cleanup workflow #25

Workflow file for this run

name: Build and Push Docker Image
on:
workflow_dispatch:
release:
types: [ created ] # Runs only when a new release is created
jobs:
build:
runs-on: ubuntu-latest
if: github.repository_owner == 'autoatml' && github.ref == 'refs/heads/main'
permissions:
contents: read
packages: write
attestations: write
id-token: write
strategy:
matrix:
python-version: [ "3.10", "3.11", "3.12" ]
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to the GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: lowercase github.repository
run: |
echo "IMAGE_NAME=`echo ${{github.repository}} | tr '[:upper:]' '[:lower:]'`" >>${GITHUB_ENV}
- name: Extract version from pyproject.toml
id: extract_version

Check failure on line 40 in .github/workflows/docker-publish.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/docker-publish.yml

Invalid workflow file

You have an error in your yaml syntax on line 40
run: |
VERSION=$(grep '^version = ' pyproject.toml | sed -E 's/version = "(.*)"/\1/')
echo "VERSION=$VERSION" >> $GITHUB_ENV
# Build Docker image with a custom Python version
- name: Build Docker image (Python ${{ matrix.python-version }})
run: |
docker build \
--build-arg PYTHON_VERSION=${{ matrix.python-version }} \
-t ghcr.io/${{ env.IMAGE_NAME }}/autoplex:python-${{ matrix.python-version }}:${{ env.VERSION }} .
# Push Docker image to GHCR
- name: Push Docker image to GHCR (Python ${{ matrix.python-version }})
run: |
docker push ghcr.io/${{ env.IMAGE_NAME }}/autoplex:python-${{ matrix.python-version }}:${{ env.VERSION }}