Skip to content

Merge pull request #46 from redlink-gmbh/dependabot/github_actions/do… #26

Merge pull request #46 from redlink-gmbh/dependabot/github_actions/do…

Merge pull request #46 from redlink-gmbh/dependabot/github_actions/do… #26

Workflow file for this run

name: Create and publish a Docker image
on:
push:
branches: [ 'main' ]
tags: [ 'v*' ]
workflow_dispatch:
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
build-and-push-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Log in to the Github Container registry
uses: docker/[email protected]
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Log in to Docker Hub
uses: docker/[email protected]
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/[email protected]
with:
images: |
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
redlinkgmbh/stanza-server
labels: |
maintainer=Redlink GmbH <[email protected]>
org.opencontainers.image.title=Stanza Server
org.opencontainers.image.vendor=Redlink GmbH
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}},enable=${{ !startsWith(github.ref, 'refs/tags/v0.') }}
- name: Build and push Docker image
uses: docker/[email protected]
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}