diff --git a/.github/actions/docker-tags/action.yml b/.github/actions/docker-tags/action.yml new file mode 100644 index 000000000..60bb80cef --- /dev/null +++ b/.github/actions/docker-tags/action.yml @@ -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" + + diff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.yml index 473f82aa8..67a6f6c22 100644 --- a/.github/workflows/docker-build.yml +++ b/.github/workflows/docker-build.yml @@ -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