constellation/.github/actions/build_micro-service/action.yml

52 lines
1.4 KiB
YAML
Raw Normal View History

name: build micro-service image
description: Build and upload a container image for a Constellation micro-service
inputs:
name:
description: 'Name of the micro-service'
required: true
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: Docker metadata
id: meta
uses: docker/metadata-action@v3
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=ref,event=branch
- name: Set up Docker Buildx
id: docker-setup
uses: docker/setup-buildx-action@v1
- name: Log in to the Container registry
id: docker-login
uses: docker/login-action@v1
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@v2
with:
context: .
file: ${{ inputs.dockerfile }}
target: release
push: true
tags: ${{ steps.meta.outputs.tags }}