diff --git a/.github/workflows/swift-toolchain.yml b/.github/workflows/swift-toolchain.yml index 64fb0a595..8011be244 100644 --- a/.github/workflows/swift-toolchain.yml +++ b/.github/workflows/swift-toolchain.yml @@ -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 @@ -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}