Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unhardcoding cd-docker-hub.yml #316

Merged
merged 1 commit into from
Jan 11, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions .github/workflows/cd-docker-hub.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ on:
types: [ published ]

env:
REGISTRY: ajustesen
IMAGE_NAME: ${{ github.repository }}
PLATFORMS: linux/amd64,linux/arm64,linux/arm/v7

jobs:
Expand All @@ -40,17 +38,21 @@ jobs:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- id: docker-image-to-lowercase
name: Convert Docker image to lower case
run: echo "DOCKER_IMAGE=$(echo ${{ secrets.DOCKER_USERNAME }}/${{ github.event.repository.name }} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
images: ${{ env.DOCKER_IMAGE }}

- name: Build and push image to Docker Hub
uses: docker/build-push-action@v3
with:
context: .
push: true
platforms: ${{ env.PLATFORMS }}
tags: ajustesen/speedtest-tracker:latest
tags: ${{ env.DOCKER_IMAGE }}:latest
labels: ${{ steps.meta.outputs.labels }}