2022-07-13 08:04:46 -04:00
|
|
|
name: Build micro service
|
2022-06-15 04:50:46 -04:00
|
|
|
description: Build and upload a container image for a Constellation micro-service
|
|
|
|
inputs:
|
|
|
|
name:
|
|
|
|
description: 'Name of the micro-service'
|
|
|
|
required: true
|
2022-06-15 05:15:33 -04:00
|
|
|
projectVersion:
|
|
|
|
description: 'Version of the micro-service'
|
|
|
|
default: '0.0.0'
|
|
|
|
required: false
|
2022-06-15 04:50:46 -04:00
|
|
|
dockerfile:
|
|
|
|
description: 'Path to the services Dockerfile'
|
|
|
|
required: true
|
|
|
|
pushTag:
|
|
|
|
description: 'Use this image tag'
|
|
|
|
required: false
|
|
|
|
githubToken:
|
|
|
|
description: 'GitHub authorization token'
|
|
|
|
required: true
|
|
|
|
|
2022-07-13 08:04:46 -04:00
|
|
|
|
|
|
|
runs:
|
2022-06-15 04:50:46 -04:00
|
|
|
using: "composite"
|
|
|
|
steps:
|
2022-07-14 09:45:04 -04:00
|
|
|
- name: Determine pseudo version
|
|
|
|
id: pseudo-version
|
|
|
|
uses: ./.github/actions/pseudo_version
|
|
|
|
|
2022-06-15 04:50:46 -04:00
|
|
|
- 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 }}
|
2022-07-14 09:45:04 -04:00
|
|
|
type=raw,value=${{ steps.pseudo-version.outputs.pseudo-version }},enable=${{ '' != steps.pseudo-version.outputs.pseudo-version }}
|
2022-06-15 04:50:46 -04:00
|
|
|
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 }}
|
2022-06-15 05:15:33 -04:00
|
|
|
build-args: |
|
|
|
|
PROJECT_VERSION=${{ inputs.projectVersion }}
|