Skip to content

Workflow file for this run

name: Build and deploy services
on:
push:
branches: [ main ]
release:
types: [ published ]
env:
REGISTRY: ghcr.io
jobs:
build:
strategy:
matrix:
service:
- tiling-service
- segmentation-service
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Log in to the Container registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:
tags: |
type=ref,event=branch,enable=true
type=ref,event=tag,enable=true
images: ${{ env.REGISTRY }}/${{ github.repository }}/${{ matrix.service }}
- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
context: ${{ matrix.service }}
push: true
# Set 'provenance: false' so there won't be a build for an unknown
# architecture (https://github.com/docker/build-push-action/issues/820)
# and calling delete-package-versions below will not result in an
# 'manifest unknown' error (https://github.com/actions/delete-package-versions/issues/90)
provenance: false
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=registry,ref=ghcr.io/${{ github.repository }}/${{ matrix.service }}:main
cache-to: type=inline
- name: Remove untagged container images
uses: actions/delete-package-versions@v4
with:
package-name: aerial-image-segmentation/${{ matrix.service }}
package-type: container
delete-only-untagged-versions: true
min-versions-to-keep: 0