bnfoneMusic v. 1.1.4 - BETA #30
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: Docker Hub | |
on: | |
release: | |
types: [published] | |
pull_request: | |
branches: [master] | |
workflow_dispatch: # Ermöglicht manuelles Auslösen | |
env: | |
REGISTRY: docker.io | |
IMAGE_NAME: ${{ github.repository }} | |
HAS_DOCKERHUB_CREDENTIALS: ${{ secrets.DOCKERHUB_USERNAME && secrets.DOCKERHUB_TOKEN }} | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
# QEMU for emulation | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
# Docker Buildx for creating multi arch docker images | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
# Login only if DOCKERHUB_USERNAME and DOCKERHUB_TOKEN are available | |
- name: Log into registry ${{ env.REGISTRY }} | |
if: env.HAS_DOCKERHUB_CREDENTIALS == 'true' | |
uses: docker/login-action@v2 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
# Extract metadata (tags, labels) for Docker | |
- name: Extract Docker metadata | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
tags: | | |
type=ref,event=branch,format={{ .Ref }},prefix=pr- | |
type=sha,prefix=sha- | |
# Build and push Docker image | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v4 | |
with: | |
context: . | |
platforms: linux/amd64,linux/arm64,linux/arm/v7 | |
push: ${{ env.HAS_DOCKERHUB_CREDENTIALS == 'true' }} | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
- name: Image digest | |
run: echo ${{ steps.docker_build.outputs.digest }} | |
if: env.HAS_DOCKERHUB_CREDENTIALS == 'true' |