Skip to content

Commit 81059d5

Browse files
authored
Unhardcoding cd-docker-hub.yml (alexjustesen#316)
1 parent 498e0cf commit 81059d5

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

.github/workflows/cd-docker-hub.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@ on:
1616
types: [ published ]
1717

1818
env:
19-
REGISTRY: ajustesen
20-
IMAGE_NAME: ${{ github.repository }}
2119
PLATFORMS: linux/amd64,linux/arm64,linux/arm/v7
2220

2321
jobs:
@@ -40,17 +38,21 @@ jobs:
4038
username: ${{ secrets.DOCKER_USERNAME }}
4139
password: ${{ secrets.DOCKER_PASSWORD }}
4240

41+
- id: docker-image-to-lowercase
42+
name: Convert Docker image to lower case
43+
run: echo "DOCKER_IMAGE=$(echo ${{ secrets.DOCKER_USERNAME }}/${{ github.event.repository.name }} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV
44+
4345
- name: Extract metadata (tags, labels) for Docker
4446
id: meta
4547
uses: docker/metadata-action@v4
4648
with:
47-
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
49+
images: ${{ env.DOCKER_IMAGE }}
4850

4951
- name: Build and push image to Docker Hub
5052
uses: docker/build-push-action@v3
5153
with:
5254
context: .
5355
push: true
5456
platforms: ${{ env.PLATFORMS }}
55-
tags: ajustesen/speedtest-tracker:latest
57+
tags: ${{ env.DOCKER_IMAGE }}:latest
5658
labels: ${{ steps.meta.outputs.labels }}

0 commit comments

Comments
 (0)