Giter Club home page Giter Club logo

setup-swift's Introduction

Setup Swift

GitHub Action Supports macOS, Ubuntu & Windows Swift 5.8 Latest release

GitHub Action that will setup a Swift environment with a specific version. 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:

- uses: swift-actions/setup-swift@v1

After the environment is configured you can run swift commands using the standard run step:

- uses: swift-actions/setup-swift@v1
- name: Get swift version
  run: swift --version # Swift 5.8

A specific Swift version can be set using the swift-version input:

- uses: swift-actions/setup-swift@v1
  with:
    swift-version: "5.1.0"
- name: Get swift version
  run: swift --version # Swift 5.1.0

Works perfect together with matrixes:

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@v1
  with:
    swift-version: ${{ matrix.swift }}
- name: Get swift version
  run: swift --version

Note about versions

This project uses strict semantic versioning to determine what version of Swift to configure. This differs slightly from the official convention used by Swift.

For example, Swift is available as version 5.1 but using this as value for swift-version 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.

In other words specifying...

  • "5.1.0" will resolve to version 5.1
  • "5.1" will resolve to latest patch version (aka 5.1.1)
  • "5" will resolve to latest minor and patch version (aka 5.8)

Caveats

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:

- uses: swift-actions/setup-swift@v1
  with:
    swift-version: '5.0'

Not:

- uses: swift-actions/setup-swift@v1
  with:
    swift-version: 5.0

Keeping the action up-to-date

You have two options for keeping this action up-to-date: either you define a specific version (like v1.17.0) or use the major version tag (like v1).

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's People

Contributors

beyondevil avatar dependabot-preview[bot] avatar dependabot[bot] avatar ffried avatar fwal avatar github-actions[bot] avatar keith avatar leonardorosaa avatar marcprux avatar michaeldorner avatar mxcl avatar nef10 avatar o-nnerb avatar rizwankce avatar sidepelican avatar soumyamahunt avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.