Skip to content

Merge pull request #884 from winged/accept_placeholders_json #985

Merge pull request #884 from winged/accept_placeholders_json

Merge pull request #884 from winged/accept_placeholders_json #985

Workflow file for this run

name: Container image
on:
release:
types: [created]
# Run build for any PRs - we won't push in those however
pull_request:
branches:
- main
# Publish `main` as Docker `dev` image.
push:
branches:
- main
concurrency:
group: build-${{ github.ref }}
cancel-in-progress: true
env:
REGISTRY: ghcr.io
jobs:
# Push image to GitHub Packages.
# See also https://docs.docker.com/build/ci/github-actions/
container-registry:
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to the Container registry
uses: docker/#-action@v3
if: github.event_name != 'pull_request'
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ github.repository }}
tags: |
type=raw,value=dev,enable={{is_default_branch}}
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
labels: |
org.opencontainers.image.title=document-merge-service
org.opencontainers.image.description=${{ github.event.repository.description }}
org.opencontainers.image.url=${{ github.event.repository.html_url }}
org.opencontainers.image.source=${{ github.event.repository.clone_url }}
org.opencontainers.image.revision=${{ github.sha }}
org.opencontainers.image.licenses=${{ github.event.repository.license.spdx_id }}
- name: Build and push
uses: docker/build-push-action@v6
with:
context: .
file: ./Dockerfile
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max