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 15, 2023
1 parent 2ad425e commit 985ed7a
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions .github/workflows/swift-toolchain.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,14 @@ jobs:
sudo DEBIAN_FRONTEND=noninteractive apt-get -qq update -yq
sudo DEBIAN_FRONTEND=noninteractive apt-get -qq -o Dpkg::Use-Pty=0 install -yq repo libxml2-utils
repo init --quiet --groups default --depth 1 -u https://github.com/compnerd/swift-build -b main
# Which branch is this workflow based on
branch_version=main
if [[ "$branch_version" == "main" ]] ; then
branch_name="main"
else
branch_name="release/${branch_version}"
fi
repo init --quiet --groups default --depth 1 -u https://github.com/compnerd/swift-build -b $branch_name
repo sync --quiet --no-clone-bundle --no-tags --jobs $(nproc --all)
if [[ "${{ github.event.inputs.snapshot }}" == "true" ]] ; then
Expand Down Expand Up @@ -137,7 +144,11 @@ jobs:
if [[ -n "${{ github.event.inputs.swift_tag }}" ]] ; then
echo swift_tag=${{ github.event.inputs.swift_tag }} | tee -a ${GITHUB_OUTPUT}
else
echo swift_tag=$(date +%Y%m%d.$(date +%-H/6 | bc)) | tee -a ${GITHUB_OUTPUT}
if [[ "$branch_version" == "main" ]] ; then
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}
fi
fi
echo windows_build_runner=${{ vars.WINDOWS_BUILD_RUNNER || 'windows-latest' }} >> ${GITHUB_OUTPUT}
Expand Down

0 comments on commit 985ed7a

Please sign in to comment.