philips-software / docker-ci-scripts

Docker CI scripts
MIT License
12 stars 9 forks source link

mixed case organizations fail (ex: PromptExecution) #243

Open elasticdotventures opened 10 months ago

elasticdotventures commented 10 months ago

The problem

build-and-push buildx failed with: ERROR: invalid tag "ghcr.io/PromptExecution/ebook-convert:v0.0.1": repository name must be lowercase

The solution:

name: Docker

on:
  push:
    branches: [ "master" ]
    tags: [ 'v*.*.*' ]
  pull_request:
    branches: [ "master" ]

env:
  REGISTRY: ghcr.io

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout repository
        uses: actions/checkout@v3

      # Additional step to set lowercase image name
      - name: Set lowercase image name
        id: set_lowercase_name
        run: echo "IMAGE_NAME_LOWER=$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV

      # ....

      # Modify this step to use the lowercase image name
      - name: Extract Docker metadata
        id: meta
        uses: docker/metadata-action@96383f45573cb7f253c731d3b3ab81c87ef81934 # v5.0.0
        with:
          images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME_LOWER }}

      # Continue with the remaining steps...

Let me know if this is acceptable resolution and I'll send up a PR.

JeroenKnoops commented 10 months ago

This is an acceptable resolution! Thanks! :)