Build and Publish Dependencies Docker (souffle 2.4) #1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and Publish Dependencies Docker (souffle 2.4) | |
on: | |
workflow_dispatch: | |
workflow_call: | |
env: | |
REGISTRY: ghcr.io | |
# github.repository as nevillegrech/gigahorse-toolchain | |
IMAGE_NAME: ${{ github.repository }}-deps-souffle24 | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
# Login against a Docker registry except on PR | |
# https://github.com/docker/login-action | |
- name: Log into registry ${{ env.REGISTRY }} | |
uses: docker/[email protected] | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
# Extract metadata (tags, labels) for Docker | |
# https://github.com/docker/metadata-action | |
- name: Extract Docker metadata | |
id: meta | |
uses: docker/[email protected] | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
# Creates an additional 'latest' tag | |
# If the job is triggered via workflow dispatch and on a master branch, tag branch and latest | |
# Otherwise, just tag as the branch name | |
- name: Finalize Docker Metadata | |
id: docker_tagging | |
run: | | |
if [[ "${GITHUB_REF##*/}" == "main" ]] || [[ ${GITHUB_REF##*/} == "master" ]]; then | |
echo "manual trigger from master/main branch, assigning latest tag" | |
echo "docker_tags=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${GITHUB_REF##*/},${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest" >> $GITHUB_OUTPUT | |
else | |
echo "Not manual release from main branch. Just tagging as branch name" | |
echo "docker_tags=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${GITHUB_REF##*/}" >> $GITHUB_OUTPUT | |
fi | |
# Log docker metadata to explicitly know what is being pushed | |
- name: Inspect Docker Metadata | |
run: | | |
echo "TAGS -> ${{ steps.docker_tagging.outputs.docker_tags }}" | |
echo "LABELS -> ${{ steps.meta.outputs.labels }}" | |
# Build and push Docker image | |
# https://github.com/docker/build-push-action | |
- name: Build and push Docker image | |
id: build-and-push | |
uses: docker/[email protected] | |
with: | |
context: . | |
file: ./docker/dependencies/souffle24/Dockerfile | |
push: true | |
tags: ${{ steps.docker_tagging.outputs.docker_tags }} | |
labels: ${{ steps.meta.outputs.labels }} |