Skip to content

Commit 3ff15f2

Browse files
authored
chore: kickoff release
2 parents d4fd3c1 + bfa71ff commit 3ff15f2

File tree

7 files changed

+107
-10
lines changed

7 files changed

+107
-10
lines changed

.circleci/config.yml

Lines changed: 33 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ version: 2.1
55
orbs:
66
macos: circleci/macos@2.3.3
77
ruby: circleci/ruby@2.0.0
8-
8+
aws-cli: circleci/aws-cli@3.1.4
99

1010
default-executor: &default-executor
1111
macos:
@@ -14,7 +14,6 @@ default-executor: &default-executor
1414
environment:
1515
FL_OUTPUT_DIR: output
1616

17-
1817
jobs:
1918
build-test-ios:
2019
<<: *default-executor
@@ -39,15 +38,39 @@ jobs:
3938
name: Unit tests
4039
command: bundle exec fastlane mac tests
4140

41+
build-test-tvos:
42+
<<: *default-executor
43+
44+
steps:
45+
- checkout
46+
- ruby/install-deps
47+
- run:
48+
name: Unit tests
49+
command: bundle exec fastlane tvos tests
50+
51+
build-test-watchos:
52+
<<: *default-executor
53+
54+
steps:
55+
- checkout
56+
- ruby/install-deps
57+
- run:
58+
name: Unit tests
59+
command: bundle exec fastlane watchos tests
60+
4261
release:
4362
<<: *default-executor
4463

4564
steps:
4665
- add_ssh_keys:
4766
fingerprints:
48-
- "5a:23:0e:1d:98:0c:04:dc:73:06:5f:c3:19:72:e2:93"
67+
- "1d:f2:37:1e:7e:38:02:e0:76:2d:6a:a8:47:2e:85:09"
4968
- checkout
5069
- ruby/install-deps
70+
- aws-cli/setup:
71+
role-arn: $AWS_OIDC_ROLE_ARN
72+
role-session-name: "${CIRCLE_WORKFLOW_JOB_ID}.release"
73+
session-duration: '900'
5174
- run:
5275
name: Publish new version to cocoapods trunk
5376
command: bundle exec fastlane ios release
@@ -58,7 +81,7 @@ jobs:
5881
steps:
5982
- add_ssh_keys:
6083
fingerprints:
61-
- "5a:23:0e:1d:98:0c:04:dc:73:06:5f:c3:19:72:e2:93"
84+
- "1d:f2:37:1e:7e:38:02:e0:76:2d:6a:a8:47:2e:85:09"
6285
- checkout
6386
- ruby/install-deps
6487
- run:
@@ -71,13 +94,19 @@ workflows:
7194
jobs:
7295
- build-test-ios
7396
- build-test-macos
97+
- build-test-tvos
98+
- build-test-watchos
7499
- release:
75100
filters:
76101
branches:
77102
only: release
78103
requires:
79104
- build-test-ios
80105
- build-test-macos
106+
- build-test-tvos
107+
- build-test-watchos
108+
context: amplify-swift-aws-oidc
109+
81110
- publish-doc:
82111
filters:
83112
branches:

Gemfile.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ GEM
1111
specs:
1212
CFPropertyList (3.0.6)
1313
rexml
14-
activesupport (6.1.7.2)
14+
activesupport (6.1.7.3)
1515
concurrent-ruby (~> 1.0, >= 1.0.2)
1616
i18n (>= 1.6, < 2)
1717
minitest (>= 5.1)
@@ -83,7 +83,7 @@ GEM
8383
colored2 (3.1.2)
8484
commander (4.6.0)
8585
highline (~> 2.0.0)
86-
concurrent-ruby (1.2.0)
86+
concurrent-ruby (1.2.2)
8787
declarative (0.0.20)
8888
digest-crc (0.6.4)
8989
rake (>= 12.0.0, < 14.0.0)
@@ -229,7 +229,7 @@ GEM
229229
mini_magick (4.12.0)
230230
mini_mime (1.1.2)
231231
mini_portile2 (2.8.1)
232-
minitest (5.17.0)
232+
minitest (5.18.0)
233233
molinillo (0.8.0)
234234
multi_json (1.15.0)
235235
multipart-post (2.0.0)
@@ -300,7 +300,7 @@ GEM
300300
rouge (~> 2.0.7)
301301
xcpretty-travis-formatter (1.0.1)
302302
xcpretty (~> 0.2, >= 0.0.7)
303-
zeitwerk (2.6.6)
303+
zeitwerk (2.6.7)
304304

305305
PLATFORMS
306306
ruby

Package.swift

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,12 @@ import PackageDescription
55

66
let package = Package(
77
name: "AmplifyUtilsNotifications",
8-
platforms: [.iOS(.v13), .macOS(.v10_15)],
8+
platforms: [
9+
.iOS(.v13),
10+
.macOS(.v10_15),
11+
.tvOS(.v13),
12+
.watchOS(.v7)
13+
],
914
products: [
1015
.library(
1116
name: "AmplifyUtilsNotifications",

Sources/AmplifyUtilsNotifications/AUNotificationPermissions.swift

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@
88
import Foundation
99
import UserNotifications
1010

11-
#if canImport(AppKit)
11+
#if canImport(WatchKit)
12+
import WatchKit
13+
#elseif canImport(AppKit)
1214
import AppKit
1315
typealias Application = NSApplication
1416
#elseif canImport(UIKit)
@@ -57,7 +59,11 @@ public class AUNotificationPermissions {
5759
/// Register device with APNs
5860
public static func registerForRemoteNotifications() async {
5961
await MainActor.run {
62+
#if canImport(WatchKit)
63+
WKExtension.shared().registerForRemoteNotifications()
64+
#else
6065
Application.shared.registerForRemoteNotifications()
66+
#endif
6167
}
6268
}
6369
}

Sources/AmplifyUtilsNotifications/AUNotificationService.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
// SPDX-License-Identifier: Apache-2.0
66
//
77

8+
#if !os(tvOS)
9+
810
import UserNotifications
911
import os.log
1012

@@ -100,3 +102,5 @@ open class AUNotificationService: UNNotificationServiceExtension {
100102
}
101103
}
102104
}
105+
106+
#endif

Tests/AmplifyUtilsNotificationsTests/AUNotificationServiceTests.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
// SPDX-License-Identifier: Apache-2.0
66
//
77

8+
#if !os(tvOS)
9+
810
import XCTest
911
@testable import AmplifyUtilsNotifications
1012
@testable import UserNotifications
@@ -149,3 +151,5 @@ final class AUNotificationServiceTests: XCTestCase {
149151
waitForExpectations(timeout: 1)
150152
}
151153
}
154+
155+
#endif

fastlane/Fastfile

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
require 'json'
2+
13
PODSPEC_PATH = "AmplifyUtilsNotifications.podspec"
24
CHANGELOG_PATH = "CHANGELOG.md"
35

@@ -103,6 +105,15 @@ platform :ios do
103105

104106
desc "Publish new version to cocoapod trunck"
105107
private_lane :publish_to_cocoapod_trunk do
108+
# Define `COCOAPODS_TRUNK_TOKEN` env var for trunk authentication
109+
# https://github.com/CocoaPods/cocoapods-trunk/commit/9e6ec1c1faf96fa837dc2ed70b5f54006b181ed6
110+
secret = sh(
111+
command: 'aws secretsmanager get-secret-value --secret-id ${COCOAPODS_SECRET_ARN}',
112+
log: false
113+
)
114+
115+
ENV['COCOAPODS_TRUNK_TOKEN'] = JSON.parse(secret)["SecretString"]
116+
106117
pod_push(
107118
use_bundle_exec: true,
108119
allow_warnings: true,
@@ -143,3 +154,41 @@ platform :mac do
143154
)
144155
end
145156
end
157+
158+
platform :tvos do
159+
before_all do
160+
setup_circle_ci
161+
end
162+
163+
desc "Run all the tests on tvOS"
164+
lane :tests do
165+
run_tests(
166+
clean: true,
167+
result_bundle: true,
168+
include_simulator_logs: false,
169+
scheme: "AmplifyUtilsNotifications",
170+
package_path: ".",
171+
sdk: "appletvsimulator",
172+
destination: "platform=tvOS Simulator,name=Apple TV 4K (3rd generation),OS=latest",
173+
)
174+
end
175+
end
176+
177+
platform :watchos do
178+
before_all do
179+
setup_circle_ci
180+
end
181+
182+
desc "Run all the tests on watchOS"
183+
lane :tests do
184+
run_tests(
185+
clean: true,
186+
result_bundle: true,
187+
include_simulator_logs: false,
188+
scheme: "AmplifyUtilsNotifications",
189+
package_path: ".",
190+
sdk: "watchsimulator",
191+
destination: "platform=watchOS Simulator,name=Apple Watch Series 8 (45mm),OS=latest",
192+
)
193+
end
194+
end

0 commit comments

Comments
 (0)