Fix Cocoapods deploy

This commit is contained in:
Max Howell
2019-01-26 13:58:51 -05:00
parent c08ccdfb30
commit bbf1f24ef6

View File

@@ -89,18 +89,28 @@ jobs:
- name: CocoaPods - name: CocoaPods
before_install: | before_install: |
DESCRIPTION=$(swift - <<EOF export DESCRIPTION=$(swift - <<\ \ EOF
import Foundation import Foundation
struct Response: Decodable { let description: String } struct Response: Decodable { let description: String }
let token = ProcessInfo.processInfo.environment["GITHUB_TOKEN"]!
let url = URL(string: "https://api.github.com/repos/mxcl/Path.swift")! let url = URL(string: "https://api.github.com/repos/mxcl/Path.swift")!
let data = try Data(contentsOf: url) var rq = URLRequest(url: url)
print(try JSONDecoder().decode(Response.self, from: data).description) rq.setValue("token \(token)", forHTTPHeaderField: "Authorization")
let semaphore = DispatchSemaphore(value: 0)
var data: Data!
URLSession.shared.dataTask(with: rq) { d, _, _ in
data = d
semaphore.signal()
}.resume()
semaphore.wait()
let rsp = try JSONDecoder().decode(Response.self, from: data)
print(rsp.description, terminator: "")
EOF) EOF)
cat <<\ \ EOF> Path.swift.podspec cat <<\ \ EOF> Path.swift.podspec
Pod::Spec.new do |s| Pod::Spec.new do |s|
s.name = 'Path.swift' s.name = 'Path.swift'
s.version = 'TRAVIS_TAG' s.version = ENV['TRAVIS_TAG']
s.summary = 'DESCRIPTION' s.summary = ENV['DESCRIPTION']
s.homepage = 'https://github.com/mxcl/Path.swift' s.homepage = 'https://github.com/mxcl/Path.swift'
s.license = { :type => 'Unlicense', :file => 'LICENSE.md' } s.license = { :type => 'Unlicense', :file => 'LICENSE.md' }
s.author = { 'mxcl' => 'mxcl@me.com' } s.author = { 'mxcl' => 'mxcl@me.com' }
@@ -114,8 +124,5 @@ jobs:
s.swift_version = '4.2' s.swift_version = '4.2'
end end
EOF EOF
sed -i '' "s/TRAVIS_TAG/$TRAVIS_TAG/" Path.swift.podspec
sed -i '' "s/DESCRIPTION/$DESCRIPTION/" Path.swift.podspec
# ^^ see the Jazzy deployment for explanation
install: gem install cocoapods --pre install: gem install cocoapods --pre
script: pod trunk push script: pod trunk push