name: Swift ${{ matrix.swift }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
swift: ["5.4.3", "5.2.4"]
steps:
- uses: swift-actions/setup-swift@v3
with:
swift-version: ${{ matrix.swift }}
- name: Get swift version
run: swift --version
Skip GPG signature verification
If you are running on a runner that is not able to verify the GPG signature of the Swiftly package, you can skip the verification by setting the skip-verify-signature input to true.
YAML interprets eg. 5.0 as a float, this action will then interpret that as 5 which will result in eg. Swift 5.5 being resolved. Quote your inputs! Thus:
You have two options for keeping this action up-to-date: either you define a specific version (like v3.0.0) or use the major version tag (like v3).
Specific version
We recommend using the specific version tag together with Dependabot to keep the action up-to-date. That way you will automatically get notifed when the action updates and you can read the changelog directly in the PR opened by dependabot.
Major version tag
If you don’t plan on keeping tabs on updates or don’t want to use Dependabot but still would like to always use the latest version, you can use the main version tag.
Legal
Uses MIT license.
The Swift logo is a trademark of Apple Inc.
Setup Swift using Swiftly
GitHub Action that will setup a Swift environment with a specific version using Swiftly. Works on both Ubuntu and macOS runners.
Usage
To run the action with the latest swift version available, simply add the action as a step in your workflow:
After the environment is configured you can run swift commands using the standard
runstep:A specific Swift version can be set using the
swift-versioninput:Also works with snapshots:
Works perfect together with matrixes:
Skip GPG signature verification
If you are running on a runner that is not able to verify the GPG signature of the Swiftly package, you can skip the verification by setting the
skip-verify-signatureinput totrue.Caveats
YAML interprets eg.
5.0as a float, this action will then interpret that as5which will result in eg. Swift 5.5 being resolved. Quote your inputs! Thus:Not:
Keeping the action up-to-date
You have two options for keeping this action up-to-date: either you define a specific version (like
v3.0.0) or use the major version tag (likev3).Specific version
We recommend using the specific version tag together with Dependabot to keep the action up-to-date. That way you will automatically get notifed when the action updates and you can read the changelog directly in the PR opened by dependabot.
Major version tag
If you don’t plan on keeping tabs on updates or don’t want to use Dependabot but still would like to always use the latest version, you can use the main version tag.
Legal
Uses MIT license. The Swift logo is a trademark of Apple Inc.