Skip to content

⬆️🪝 Update pre-commit hook srstevenson/nb-clean to v4 #36

⬆️🪝 Update pre-commit hook srstevenson/nb-clean to v4

⬆️🪝 Update pre-commit hook srstevenson/nb-clean to v4 #36

Workflow file for this run

name: 🐳 Publish Docker image
on:
workflow_dispatch:
push:
branches:
- "main"
tags:
- "v*"
pull_request:
branches:
- "main"
jobs:
push_to_registry:
name: Push Docker image to Docker Hub
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
attestations: write
id-token: write
steps:
- name: Check out the repo
uses: actions/checkout@v4
with:
fetch-depth: 0
# Check whether the Docker credentials are available as secrets. If both are set, then set a boolean flag and export it to the environment.
- name: Check Docker credentials
run: |
if [ -z "${{ secrets.DOCKERHUB_USERNAME }}" ] || [ -z "${{ secrets.DOCKERHUB_TOKEN }}" ]; then
echo "::notice title=Docker credentials are not set.::If you want to run this job on a PR from a fork, you need to set the DOCKERHUB_USERNAME and DOCKERHUB_TOKEN secrets in the repository settings."
echo "DOCKER_CREDENTIALS_SET=false" >> $GITHUB_ENV
else
echo "::notice title=Docker credentials are set.::The subsequent steps will run."
echo "DOCKER_CREDENTIALS_SET=true" >> $GITHUB_ENV
fi
- name: Login to Docker Hub
if: env.DOCKER_CREDENTIALS_SET == 'true'
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Docker meta
if: env.DOCKER_CREDENTIALS_SET == 'true'
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ secrets.DOCKERHUB_USERNAME }}/mqt-bench
- name: Build and push Docker image
if: env.DOCKER_CREDENTIALS_SET == 'true'
id: push
uses: docker/build-push-action@v6
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}