Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions .github/actions/get-branch/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: get-branch
description: extracts the branch in readable form
author: datavisyn

inputs:
branch:
description: "branch override"
required: false

outputs:
branch:
description: "extracted branch"
value: ${{ steps.get-branch.outputs.branch }}
commit_hash:
description: "extracted commit hash"
value: ${{ steps.get-branch.outputs.commit_hash }}

runs:
using: "composite"
steps:
- name: Extract branch and commit hash
shell: bash
id: get-branch
run: |
# Use HEAD_REF for PRs, fallback to REF_NAME for pushes.
BRANCH_NAME_RAW="${HEAD_REF:-"$REF_NAME"}"
# Clean up the ref by removing 'refs/heads/' or 'refs/tags/'
BRANCH_NAME="${BRANCH_NAME_RAW#refs/heads/}"
BRANCH_NAME="${BRANCH_NAME#refs/tags/}"

# A manual input from workflow_dispatch will always override the detected branch name
if [ -n "${MANUAL_BRANCH}" ]; then
BRANCH_NAME="${MANUAL_BRANCH}"
fi

echo "branch=${BRANCH_NAME}" >> $GITHUB_OUTPUT
echo "commit_hash=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
env:
HEAD_REF: ${{ github.head_ref }}
REF_NAME: ${{ github.ref_name }}
MANUAL_BRANCH: ${{ inputs.branch }}
9 changes: 8 additions & 1 deletion .github/workflows/build-docker-artifacts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ concurrency:
cancel-in-progress: true

env:
WORKFLOW_BRANCH: "main"
WORKFLOW_BRANCH: "mp/docker_branch"
PYTHON_BASE_IMAGE: "python:3.10.18-slim-bullseye"
DATAVISYN_PYTHON_BASE_IMAGE: "188237246440.dkr.ecr.eu-central-1.amazonaws.com/datavisyn/base/python:main"
NODE_BASE_IMAGE: "node:20.9-bullseye"
Expand Down Expand Up @@ -211,6 +211,11 @@ jobs:
id: login-ecr
uses: aws-actions/[email protected]

- uses: ./tmp/github-workflows/.github/actions/get-branch
id: get-branch
with:
branch: ${{ inputs.branch }}

- name: Build image
uses: docker/build-push-action@v6
with:
Expand All @@ -223,6 +228,8 @@ jobs:
# Disable the cache to avoid outdated (base) images
no-cache: true
build-args: |
GIT_BRANCH=${{ steps.get-branch.outputs.branch }}
GIT_COMMIT_HASH=${{ steps.get-branch.outputs.commit_hash }}
DOCKERFILE_DIRECTORY=${{ matrix.component.flavor_directory }}/${{ matrix.component.directory }}
PYTHON_BASE_IMAGE=${{ env.PYTHON_BASE_IMAGE }}
DATAVISYN_PYTHON_BASE_IMAGE=${{ env.DATAVISYN_PYTHON_BASE_IMAGE }}
Expand Down