Skip to content

Push Docker image to Docker Hub #960

Push Docker image to Docker Hub

Push Docker image to Docker Hub #960

Workflow file for this run

name: Push Docker image to Docker Hub
on:
push:
branches:
- main
paths-ignore:
- ".editorconfig"
- ".github/**"
- ".gitignore"
- ".husky/**"
- ".prettierignore"
- ".prettierrc"
- "docs/**"
- "eslint.config.mjs"
- "README.md"
workflow_run:
workflows: ["Dependabot auto-merge"]
types:
- completed
workflow_dispatch:
jobs:
build-and-push:
runs-on: ubuntu-latest
if: github.event.workflow_run.conclusion == 'success' || github.event_name != 'workflow_run'
steps:
- uses: actions/checkout@v6
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: electh/reactflux
tags: |
type=raw,value=latest,enable=true
type=sha,format=long,prefix=,enable=true
- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
platforms: linux/amd64,linux/arm64
cache-from: type=gha,scope=docker-release
cache-to: type=gha,mode=max,scope=docker-release