Publish Docker image #341
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 Docker image | |
concurrency: | |
group: docker-${{ github.ref }} | |
cancel-in-progress: true | |
on: | |
workflow_run: | |
workflows: | |
- Run tests | |
branches: | |
- main | |
types: | |
- completed | |
jobs: | |
push_to_registry: | |
if: ${{ github.event.workflow_run.conclusion == 'success' }} | |
name: Push Docker image to Docker Hub | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out the repo | |
uses: actions/checkout@v4 | |
- name: Log in to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v6 | |
with: | |
context: . | |
file: deploy/Dockerfile | |
push: true | |
tags: nning2/imgshr:latest | |
cache-from: type=gha | |
cache-to: type=gha,mode=max |