chore(ci): use composite action to extract docker variables

This commit is contained in:
Matthias
2025-09-02 19:57:33 +02:00
parent 94aba0f9ac
commit a94d18a10b
2 changed files with 47 additions and 35 deletions

45
.github/actions/docker-tags/action.yml vendored Normal file
View File

@@ -0,0 +1,45 @@
name: 'docker-tags'
description: 'Set Docker default Tag environment variables'
# inputs:
# outputs:
runs:
using: "composite"
steps:
- name: Extract branch name
shell: bash
env:
BRANCH_NAME_INPUT: ${{ github.event.inputs.branch_name }}
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
BRANCH_NAME="${BRANCH_NAME_INPUT}"
else
BRANCH_NAME="${GITHUB_REF##*/}"
fi
# Replace / with _ to create a valid tag
TAG=$(echo "${BRANCH_NAME}" | sed -e "s/\//_/g")
TAG_PLOT=${TAG}_plot
TAG_FREQAI=${TAG}_freqai
TAG_FREQAI_RL=${TAG_FREQAI}rl
TAG_PI="${TAG}_pi"
CACHE_TAG_PI=${CACHE_IMAGE}:${TAG_PI}_cache
echo "GITHUB_REF='${GITHUB_REF}'"
echo "BRANCH_NAME='${BRANCH_NAME}'"
echo "TAG='${TAG}'"
echo "TAG_PLOT='${TAG_PLOT}'"
echo "TAG_FREQAI='${TAG_FREQAI}'"
echo "TAG_FREQAI_RL='${TAG_FREQAI_RL}'"
echo "TAG_PI='${TAG_PI}'"
echo "BRANCH_NAME=${BRANCH_NAME}" >> "$GITHUB_ENV"
echo "TAG=${TAG}" >> "$GITHUB_ENV"
echo "TAG_PLOT=${TAG_PLOT}" >> "$GITHUB_ENV"
echo "TAG_FREQAI=${TAG_FREQAI}" >> "$GITHUB_ENV"
echo "TAG_FREQAI_RL=${TAG_FREQAI_RL}" >> "$GITHUB_ENV"
echo "TAG_PI=${TAG_PI}" >> "$GITHUB_ENV"
echo "CACHE_TAG_PI=${CACHE_TAG_PI}" >> "$GITHUB_ENV"

View File

@@ -42,41 +42,8 @@ jobs:
with:
python-version: "3.12"
- name: Extract branch name
env:
BRANCH_NAME_INPUT: ${{ github.event.inputs.branch_name }}
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
BRANCH_NAME="${BRANCH_NAME_INPUT}"
else
BRANCH_NAME="${GITHUB_REF##*/}"
fi
# Replace / with _ to create a valid tag
TAG=$(echo "${BRANCH_NAME}" | sed -e "s/\//_/g")
TAG_PLOT=${TAG}_plot
TAG_FREQAI=${TAG}_freqai
TAG_FREQAI_RL=${TAG_FREQAI}rl
TAG_PI="${TAG}_pi"
CACHE_TAG_PI=${CACHE_IMAGE}:${TAG_PI}_cache
echo "GITHUB_REF='${GITHUB_REF}'"
echo "BRANCH_NAME='${BRANCH_NAME}'"
echo "TAG='${TAG}'"
echo "TAG_PLOT='${TAG_PLOT}'"
echo "TAG_FREQAI='${TAG_FREQAI}'"
echo "TAG_FREQAI_RL='${TAG_FREQAI_RL}'"
echo "TAG_PI='${TAG_PI}'"
echo "BRANCH_NAME=${BRANCH_NAME}" >> "$GITHUB_ENV"
echo "TAG=${TAG}" >> "$GITHUB_ENV"
echo "TAG_PLOT=${TAG_PLOT}" >> "$GITHUB_ENV"
echo "TAG_FREQAI=${TAG_FREQAI}" >> "$GITHUB_ENV"
echo "TAG_FREQAI_RL=${TAG_FREQAI_RL}" >> "$GITHUB_ENV"
echo "TAG_PI=${TAG_PI}" >> "$GITHUB_ENV"
echo "CACHE_TAG_PI=${CACHE_TAG_PI}" >> "$GITHUB_ENV"
- name: Set docker tag names
uses: ./.github/actions/docker-tags
- name: Save commit SHA to file
# Add commit to docker container