docker-release.yml

89 lines | 2.322 kB Blame History Raw Download
name: Docker Release

on:
  push:
    tags:
      - "v*"

permissions:
  contents: read
  packages: write

env:
  REGISTRY: ghcr.io
  IMAGE_NAME: ${{ github.repository }}

jobs:
  publish-merged:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v6.0.3

      - name: Set up Docker Buildx
        uses: docker/setup-buildx-action@v4.1.0

      - name: Log in to GitHub Container Registry
        uses: docker/login-action@v4.2.0
        with:
          registry: ${{ env.REGISTRY }}
          username: ${{ github.actor }}
          password: ${{ secrets.GITHUB_TOKEN }}

      - name: Docker metadata
        id: meta
        uses: docker/metadata-action@v6.0.0
        with:
          images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
          tags: |
            type=semver,pattern={{version}}
            type=semver,pattern={{major}}.{{minor}}
            type=semver,pattern={{major}}
            type=raw,value=latest

      - name: Build and push merged image
        uses: docker/build-push-action@v7.2.0
        with:
          context: .
          file: docker/Dockerfile
          build-args: |
            OWL2VOWL_GIT_REF=master
          push: true
          tags: ${{ steps.meta.outputs.tags }}
          labels: ${{ steps.meta.outputs.labels }}
          cache-from: type=gha
          cache-to: type=gha,mode=max

  publish-frontend:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v6.0.3

      - uses: docker/setup-buildx-action@v4.1.0

      - uses: docker/login-action@v4.2.0
        with:
          registry: ${{ env.REGISTRY }}
          username: ${{ github.actor }}
          password: ${{ secrets.GITHUB_TOKEN }}

      - name: Docker metadata (frontend)
        id: meta
        uses: docker/metadata-action@v6.0.0
        with:
          images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-frontend
          tags: |
            type=semver,pattern={{version}}
            type=semver,pattern={{major}}.{{minor}}
            type=raw,value=latest

      - name: Build and push frontend-only image
        uses: docker/build-push-action@v7.2.0
        with:
          context: .
          file: docker/Dockerfile.frontend
          push: true
          tags: ${{ steps.meta.outputs.tags }}
          labels: ${{ steps.meta.outputs.labels }}
          cache-from: type=gha
          cache-to: type=gha,mode=max