Skip to content

Commit

Permalink
deploy: correctly name the branch for both PR and tag builds
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisandreae committed Dec 10, 2023
1 parent 20f7d56 commit c0dbb3c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion .github/workflows/build-container.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,11 @@ jobs:
shell: bash
run: |
if [ "$GITHUB_HEAD_REF" ]; then
branch_ref="$GITHUB_HEAD_REF"
type="pr"
tag="pr${PR_NUMBER}.${GITHUB_HEAD_REF}"
elif [[ "$GITHUB_REF" == refs/tags/* ]]; then
branch_ref="$GITHUB_REF"
type="tag"
tag="${GITHUB_REF#refs/tags/}"
else
Expand All @@ -49,6 +51,7 @@ jobs:
fi
# Replace / with . in container tag names
tag="${tag//\//.}"
echo "VERSION_BRANCH="${branch_ref}" >> $GITHUB_ENV
echo "VERSION_TYPE=${type}" >> $GITHUB_ENV
echo "VERSION_NAME=${tag}" >> $GITHUB_ENV
id: extract_name
Expand Down Expand Up @@ -93,7 +96,7 @@ jobs:
--arg version_name "$VERSION_NAME" \
--arg revision "$REVISION_TAG" \
--arg release_time "$timestamp" \
--arg branch "$GITHUB_REF" \
--arg branch "$VERSION_BRANCH" \
--arg digest "$digest" \
--arg api_version "$api_version" \
> "/tmp/$VERSION_NAME.json"
Expand Down

0 comments on commit c0dbb3c

Please sign in to comment.