Here's a config for a GitHub Actions workflow to build a Swift project. This example is for building a Vapor project using Swift 5.0.3 on Ubuntu 18.04:
name: Ubuntu 18.04 Swift 5.0.3
on: [push]
jobs:
build_on_ubuntu:
runs-on: ubuntu-18.04
steps:
- name: Install dependencies
run: sudo apt-get update; sudo apt-get install -yq libssl-dev zlib1g-dev
- name: Checkout
uses: actions/checkout@master
- name: Download Swift
run: curl https://swift.org/builds/swift-5.0.3-release/ubuntu1804/swift-5.0.3-RELEASE/swift-5.0.3-RELEASE-ubuntu18.04.tar.gz --output swift.tar.gz
- name: Unpack Swift
run: |
tar xzf swift.tar.gz
mv swift-5.0.3-RELEASE-ubuntu18.04 swift
- name: Swift build
run: |
export PATH=$(pwd)/swift/usr/bin:"${PATH}"
swift build -c release