constellation/.github/actions/build_micro_service/action.yml
Daniel Weiße 5da92d9d8b AB#2249 Rework image build pipeline (#326)
* Rework image build pipeline

* Dont cancel workflow runs on main

Signed-off-by: Daniel Weiße <dw@edgeless.systems>
2022-08-03 16:01:36 +02:00

64 lines
2.0 KiB
YAML

name: Build micro service
description: Build and upload a container image for a Constellation micro-service
inputs:
name:
description: 'Name of the micro-service'
required: true
projectVersion:
description: 'Version of the micro-service'
default: '0.0.0'
required: false
dockerfile:
description: 'Path to the services Dockerfile'
required: true
pushTag:
description: 'Use this image tag'
required: false
githubToken:
description: 'GitHub authorization token'
required: true
runs:
using: "composite"
steps:
- name: Determine pseudo version
id: pseudo-version
uses: ./.github/actions/pseudo_version
- name: Docker metadata
id: meta
uses: docker/metadata-action@b2391d37b4157fa4aa2e118d643f417910ff3242
with:
images: |
ghcr.io/${{ github.repository }}/${{ inputs.name }}
tags: |
type=raw,value=latest,enable={{is_default_branch}}
type=raw,value=${{ inputs.pushTag }},enable=${{ '' != inputs.pushTag }}
type=raw,value=${{ steps.pseudo-version.outputs.pseudoVersion }},enable=${{ '' != steps.pseudo-version.outputs.pseudoVersion }}
type=ref,event=branch
- name: Set up Docker Buildx
id: docker-setup
uses: docker/setup-buildx-action@f211e3e9ded2d9377c8cadc4489a4e38014bc4c9
- name: Log in to the Container registry
id: docker-login
uses: docker/login-action@dd4fa0671be5250ee6f50aedf4cb05514abda2c7
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ inputs.githubToken }}
- name: Build and push container image
id: build-micro-service
uses: docker/build-push-action@ac9327eae2b366085ac7f6a2d02df8aa8ead720a
with:
context: .
file: ${{ inputs.dockerfile }}
target: release
push: true
tags: ${{ steps.meta.outputs.tags }}
build-args: |
PROJECT_VERSION=${{ inputs.projectVersion }}