Skip to content

Commit 3eaca1e

Browse files
author
Tamas Pallos
committed
Append current date to COMMIT_ID for tagging docker images
1 parent 1e11f2f commit 3eaca1e

2 files changed

Lines changed: 10 additions & 3 deletions

File tree

.github/workflows/test-extract-metadata-action.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,5 +23,4 @@ jobs:
2323
- name: Check that IMAGE_NAME environment variable is created and is valid
2424
run: '[[ "$IMAGE_NAME" == "hsldevcom/jore4-tools" ]]'
2525

26-
# (tests for BRANCH_NAME and COMMIT_ID omitted for now as they might change on each run so its a little bit tricky to test those)
27-
26+
# (tests for BRANCH_NAME, CURRENT_DATE and COMMIT_ID are omitted for now as they might change on each run so its a little bit tricky to test those)

github-actions/extract-metadata/action.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,17 @@ runs:
2828
echo "IMAGE_NAME=${GITHUB_REPOSITORY,,}" >> $GITHUB_ENV
2929
shell: bash
3030

31+
- name: Extract current date
32+
id: current-date
33+
run: |
34+
# fetches the current date (UTC) in "yyyymmdd" format
35+
CURRENT_DATE=$(date +"%Y%m%d")
36+
echo "CURRENT_DATE=${CURRENT_DATE}" >> "${GITHUB_ENV}"
37+
shell: bash
38+
3139
- name: Extract commit id
3240
id: commit-id
3341
run: |
3442
# Docker tags can use only some special characters.
35-
echo "COMMIT_ID=$(echo "${BRANCH_NAME}" | tr -C '0-9a-zA-Z._' '-')-${GITHUB_SHA}" >> $GITHUB_ENV
43+
echo "COMMIT_ID=$(echo "${BRANCH_NAME}" | tr -C '0-9a-zA-Z._' '-')-${CURRENT_DATE}-${GITHUB_SHA}" >> $GITHUB_ENV
3644
shell: bash

0 commit comments

Comments
 (0)