Implement lower case transformation for repository name in Docker workflow

This commit is contained in:
coconut49 2023-10-24 12:42:04 +08:00
parent 0b1b73e23a
commit 33bbeaa397
No known key found for this signature in database

View file

@ -20,19 +20,24 @@ jobs:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: set lower case repository name
run: |
echo "REPOSITORY_LC=${REPOSITORY,,}" >>${GITHUB_ENV}
env:
REPOSITORY: '${{ github.repository }}'
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository,, }}
images: ghcr.io/${{ REPOSITORY_LC }}
- name: Get tag to build
id: tag
run: |
echo "latest=ghcr.io/${{ github.repository,, }}:latest" >> $GITHUB_OUTPUT
echo "latest=ghcr.io/${{ REPOSITORY_LC }}:latest" >> $GITHUB_OUTPUT
if [[ -z "${{ github.event.inputs.tag }}" ]]; then
echo "versioned=ghcr.io/${{ github.repository,, }}:${{ github.ref_name }}" >> $GITHUB_OUTPUT
echo "versioned=ghcr.io/${{ REPOSITORY_LC }}:${{ github.ref_name }}" >> $GITHUB_OUTPUT
else
echo "versioned=ghcr.io/${{ github.repository,, }}:${{ github.event.inputs.tag }}" >> $GITHUB_OUTPUT
echo "versioned=ghcr.io/${{ REPOSITORY_LC }}:${{ github.event.inputs.tag }}" >> $GITHUB_OUTPUT
fi
- name: Build and release Docker images
uses: docker/build-push-action@v5