无法使用 Swift 4 部署到 Vapor Cloud

Cannot Deploy To Vapor Cloud with Swift 4

我尝试部署 hello world 应用程序以进行测试。我检查了我的 swift 工具版本,它是 4.0

acme-iMac:HelloWorldWeb johndoe$ swift --version
Apple Swift version 4.0 (swift-4.0-RELEASE)
Target: x86_64-apple-macosx10.9

我也用 swiftenv 也指向 4.0 版。

acme-iMac:HelloWorldWeb johndoe$ swiftenv version
4.0 (set by /Users/johndoe/Vapor/HelloWorldWeb/.swift-version)

Package.swift 文件似乎也不错

// swift-tools-version:4.0

import PackageDescription

let package = Package(
    name: "HelloWorldWeb",
    products: [
        .library(name: "App", targets: ["App"]),
        .executable(name: "Run", targets: ["Run"])
    ],
    dependencies: [
        .package(url: "https://github.com/vapor/vapor.git", .upToNextMajor(from: "2.2.0")),
        .package(url: "https://github.com/vapor/leaf-provider.git", .upToNextMajor(from: "1.1.0")),
    ],
    targets: [
        .target(name: "App", dependencies: ["Vapor", "LeafProvider"],
               exclude: [
                   "Config",
                   "Database",
                   "Public",
                   "Resources"
               ]),
        .target(name: "Run", dependencies: ["App"]),
        .testTarget(name: "AppTests", dependencies: ["App", "Testing"])
    ]
)

但是每次我尝试部署vapor cloud,总是失败。

Creating deployment [Done]
Connecting to build logs ...
Waiting in Queue [Done]
Checkout branch 'master' [Done]
Verifying base folder [Done]
Selected swift version: 3.1.0 [Done]
Selected swift version: 3.1.0 [Done]
Building vapor [Failed]
swift-build: error: Package requires minimum Swift tools version 4.0.0. Current Swift tools version is 3.1.0

Error: deploy failed.

应用 运行 在本地计算机上成功。

需要告诉蒸气云使用Swift 4;它默认为 3.1.

将名为cloud.yml的文件添加到项目的根目录,包含:

type: "vapor"
swift_version: "4.0.0"

Vapor 1 服务器 - 我发现唯一需要的行是: swift_version: "4.0.0"

这导致了错误 - 没有它也能工作: 输入:"vapor"