Publish Images #6
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Publish Images | |
on: | |
release: | |
types: | |
- prereleased | |
- released | |
jobs: | |
publish-images: | |
runs-on: ubuntu-latest | |
steps: | |
# git settings | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Configure Git | |
run: | | |
git config user.name "$GITHUB_ACTOR" | |
git config user.email "$GITHUB_ACTOR@users.noreply.github.com" | |
- name: Set up Docker Buildx # needed for multi-platform builds | |
uses: docker/setup-buildx-action@v3 | |
# create metadata for docker images | |
- name: Generate Docker Metadata | |
id: metadata | |
uses: docker/metadata-action@v5 | |
with: | |
images: | | |
viadee/docker-hub-rate-limit-exporter | |
public.ecr.aws/m4k8r3n4/docker-hub-rate-limit-exporter | |
tags: | | |
type=semver,pattern={{version}} | |
type=semver,pattern={{major}}.{{minor}} | |
# login to DockerHub and ECR | |
- name: Login to DockerHub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_HUB_SA_USERNAME }} | |
password: ${{ secrets.DOCKER_HUB_SA_PASSWORD }} | |
- name: Login to ECR | |
uses: docker/login-action@v3 | |
with: | |
registry: public.ecr.aws | |
username: ${{ secrets.AWS_PROD_ECR_VIADEE_ACCESS_KEY_ID }} | |
password: ${{ secrets.AWS_PROD_ECR_VIADEE_SECRET_ACCESS_KEY }} | |
env: | |
AWS_REGION: us-east-1 | |
# build & push images | |
- name: Build & Push Docker Images | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
platforms: linux/amd64,linux/arm64 | |
push: true | |
tags: ${{ steps.metadata.outputs.tags }} | |
labels: ${{ steps.metadata.outputs.labels }} |