apologies if this is a very basic question, i do not develop on macOS most of the time.
right now, i am installing nightly-5.8 in GitHub actions using the following:
env:
SWIFT_TOOLCHAIN_DIRECTORY: /Library/Developer/Toolchains/swift-${{ matrix.swift.toolchain }}.xctoolchain
strategy:
matrix:
os:
- runner: macos-12
prefix: xcode
swift:
- toolchain: 5.8-DEVELOPMENT-SNAPSHOT-2023-03-07-a
branch: swift-5.8-branch
steps:
- uses: actions/checkout@v2
- name: cache swift toolchains
uses: actions/cache@v2
with:
path: swift-${{ matrix.swift.toolchain }}.pkg
key: ${{ matrix.os.runner }}:swift:${{ matrix.swift.toolchain }}
- name: cache status
id: cache_status
uses: andstor/file-existence-action@v1
with:
files: swift-${{ matrix.swift.toolchain }}.pkg
- name: download swift toolchain
if: steps.cache_status.outputs.files_exists == 'false'
run: "curl https://download.swift.org/\
${{ matrix.swift.branch }}/\
${{ matrix.os.prefix }}/\
swift-${{ matrix.swift.toolchain }}/\
swift-${{ matrix.swift.toolchain }}-osx.pkg \
--output swift-${{ matrix.swift.toolchain }}.pkg"
- name: set up swift
run: |
sudo installer -pkg swift-${{ matrix.swift.toolchain }}.pkg -target /
and then i use the toolchain in subsequent steps like:
- name: build
run: |
$SWIFT_TOOLCHAIN_DIRECTORY/usr/bin/swift --version
$SWIFT_TOOLCHAIN_DIRECTORY/usr/bin/swift build
is there a simple way to configure the macOS runner so that the swift
command uses the $SWIFT_TOOLCHAIN_DIRECTORY/usr/bin/swift
toolchain instead of the 5.7.3 toolchain?