constellation/.github/actions/build_micro_service/action.yml
2022-09-19 01:09:56 -07:00

59 lines
1.9 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
# Linux runner only (Docker required)
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: 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 }}