constellation/.github/actions/build_micro_service/action.yml

59 lines
1.9 KiB
YAML
Raw Normal View History

name: Build micro service
description: Build and upload a container image for a Constellation micro-service
inputs:
name:
2022-09-14 09:14:26 -04:00
description: "Name of the micro-service"
required: true
projectVersion:
2022-09-14 09:14:26 -04:00
description: "Version of the micro-service"
default: "0.0.0"
required: false
dockerfile:
2022-09-14 09:14:26 -04:00
description: "Path to the services Dockerfile"
required: true
pushTag:
2022-09-14 09:14:26 -04:00
description: "Use this image tag"
required: false
githubToken:
2022-09-14 09:14:26 -04:00
description: "GitHub authorization token"
required: true
2022-09-14 09:14:26 -04:00
# 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@12cce9efe0d49980455aaaca9b071c0befcdd702 # tag=v4.1.0
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@f4ef78c080cd8ba55a85445d5b36e214a81df20a # tag=v2.1.0
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@c56af957549030174b10d6867f20e78cfd7debc5 # tag=v3.2.0
with:
context: .
file: ${{ inputs.dockerfile }}
target: release
push: true
tags: ${{ steps.meta.outputs.tags }}
build-args: |
PROJECT_VERSION=${{ inputs.projectVersion }}