|
1 |
| -# setup-swift |
2 |
| -GitHub Action to setup Swift |
| 1 | +# Setup Swift |
| 2 | +<img src=".github/swift.svg" height="20"> |
| 3 | +<img src="https://img.shields.io/badge/macOS-grey"> |
| 4 | +<img src="https://img.shields.io/badge/Ubuntu-grey"> |
| 5 | + |
| 6 | +GitHub Action to setup a Swift environment with a specific version. Works on both Ubuntu and macOS environments. |
| 7 | + |
| 8 | +## Usage |
| 9 | + |
| 10 | +To run the action with the latest swift version available, simply add the action as a step in your workflow: |
| 11 | + |
| 12 | +```yaml |
| 13 | +- uses: fwal/setup-swift@master |
| 14 | +``` |
| 15 | +
|
| 16 | +A version can be provided by setting the `swift-version` input: |
| 17 | + |
| 18 | +```yaml |
| 19 | +- uses: fwal/setup-swift@master |
| 20 | + with: |
| 21 | + swift-version: "5.1.0" |
| 22 | +``` |
| 23 | + |
| 24 | +Works perfect together with matrixes: |
| 25 | + |
| 26 | +```yaml |
| 27 | +name: Swift ${{ matrix.swift }} on ${{ matrix.os }} |
| 28 | +runs-on: ${{ matrix.os }} |
| 29 | +strategy: |
| 30 | + matrix: |
| 31 | + os: [ubuntu-latest, macos-latest] |
| 32 | + swift: ["5.1.0", "4.2.4"] |
| 33 | +steps: |
| 34 | +- uses: fwal/setup-swift@master |
| 35 | + with: |
| 36 | + swift-version: ${{ matrix.swift }} |
| 37 | +``` |
| 38 | + |
| 39 | +## Note about versions |
| 40 | + |
| 41 | +This project uses strict semantic versioning to determine what version of Swift to configure. This differs slightly from the official convention used by Swift. |
| 42 | + |
| 43 | +For example, Swift is available as version `5.1` but this will be interpreted as a version _range_ of `5.1.X` where `X` is the latest patch version available for that major and minor version. |
| 44 | + |
| 45 | + |
| 46 | +In other words specifying... |
| 47 | +- `"5.1.0"` will resolve to version `5.1` |
| 48 | +- `"5.1"` will resolve to latest patch version (aka `5.1.1`) |
| 49 | +- `"5"` will resolve to latest minor and patch version (aka `5.1.1`) |
| 50 | + |
| 51 | + |
| 52 | +## Legal |
| 53 | +Uses MIT license. |
| 54 | +The Swift logo is a trademark of Apple Inc. |
0 commit comments