Skip to content

Commit

Permalink
github swift-toolchain workflow: use a release-specific release tag n…
Browse files Browse the repository at this point in the history
…ame when a non-main branch is built
  • Loading branch information
hyp committed Dec 18, 2023
1 parent 985ed7a commit cf63afe
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions .github/workflows/swift-toolchain.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,18 @@ jobs:
sudo DEBIAN_FRONTEND=noninteractive apt-get -qq -o Dpkg::Use-Pty=0 install -yq repo libxml2-utils
# Which branch is this workflow based on
<<<<<<< HEAD
branch_version=main
if [[ "$branch_version" == "main" ]] ; then
=======
branch_version_string=${{ github.event.inputs.swift_version || '0.0.0' }}
if echo "$branch_version_string" | grep '\.'; then
branch_version="$(echo "$branch_version_string" | cut -d '.' -f 1).$(echo "$branch_version_string" | cut -d '.' -f 2)"
else
branch_version="$branch_version_string"
fi
if [[ "$branch_version" == "0.0" ]] ; then
>>>>>>> 926d11a (github swift-toolchain workflow: use a release-specific release tag name when a non-main branch is built)
branch_name="main"
else
branch_name="release/${branch_version}"
Expand Down Expand Up @@ -144,7 +154,11 @@ jobs:
if [[ -n "${{ github.event.inputs.swift_tag }}" ]] ; then
echo swift_tag=${{ github.event.inputs.swift_tag }} | tee -a ${GITHUB_OUTPUT}
else
<<<<<<< HEAD
if [[ "$branch_version" == "main" ]] ; then
=======
if [[ "$branch_name" == "main" ]] ; then
>>>>>>> 926d11a (github swift-toolchain workflow: use a release-specific release tag name when a non-main branch is built)
echo swift_tag=$(date +%Y%m%d.$(date +%-H/6 | bc)) | tee -a ${GITHUB_OUTPUT}
else
echo swift_tag=swift-"$branch_version"-$(date +%Y%m%d.$(date +%-H/6 | bc)) | tee -a ${GITHUB_OUTPUT}
Expand Down

0 comments on commit cf63afe

Please sign in to comment.