1
+ require 'json'
1
2
require_relative './amplify_pods.rb'
2
3
3
4
opt_out_usage
@@ -6,15 +7,15 @@ default_platform(:ios)
6
7
PLIST_KEY = "CFBundleShortVersionString"
7
8
8
9
platform :ios do
9
- before_all do
10
- # Perform a fetch before inferring the next version
10
+ before_all do
11
+ # Perform a fetch before inferring the next version
11
12
# to reduce race conditions with simultaneous pipelines attempting to create the same tag
12
13
sh ( 'git' , 'fetch' , '--tags' , '-f' )
13
14
sh ( 'git' , 'fetch' )
14
15
sh ( 'git' , 'status' )
15
16
end
16
17
desc "Create a pre-release version by pushing a tag to GitHub, and pushing pods to CocoaPods"
17
- lane :unstable do
18
+ lane :unstable do
18
19
next_version = calculate_next_canary_version
19
20
if next_version >= '2.0.0'
20
21
UI . message ( "Received version: #{ next_version } , exiting lane because version is larger than 2.0.0" )
@@ -32,8 +33,17 @@ platform :ios do
32
33
release_pods ( )
33
34
end
34
35
35
- desc "Create a release version by building and committing a changelog, pushing a tag to GitHub, and pushing pods to CocoaPods"
36
+ desc "Create a release version by building and committing a changelog, pushing a tag to GitHub, and pushing pods to CocoaPods"
36
37
lane :release do
38
+ # Define `COCOAPODS_TRUNK_TOKEN` env var for trunk authentication
39
+ # https://github.com/CocoaPods/cocoapods-trunk/commit/9e6ec1c1faf96fa837dc2ed70b5f54006b181ed6
40
+ secret = sh (
41
+ command : 'aws secretsmanager get-secret-value --secret-id ${COCOAPODS_SECRET_ARN}' ,
42
+ log : false
43
+ )
44
+
45
+ ENV [ 'COCOAPODS_TRUNK_TOKEN' ] = JSON . parse ( secret ) [ "SecretString" ]
46
+
37
47
next_version , commits = calculate_next_release_version ( version_limit :'v2.0.0' )
38
48
if next_version >= '2.0.0'
39
49
UI . message ( "Received version: #{ next_version } , exiting lane because version is larger than 2.0.0" )
@@ -46,7 +56,7 @@ platform :ios do
46
56
47
57
changelog = build_changelog ( version : next_version , commits : commits )
48
58
49
- # Commit and push
59
+ # Commit and push
50
60
release_commit ( version : next_version )
51
61
52
62
# Create tag and push to origin
@@ -80,7 +90,7 @@ platform :ios do
80
90
set_key_value ( file : "build-support/dependencies.rb" , key : "AMPLIFY_VERSION" , value : version )
81
91
end
82
92
end
83
-
93
+
84
94
desc "Commit and push"
85
95
private_lane :release_commit do |options |
86
96
next_version = options [ :version ]
@@ -94,7 +104,7 @@ platform :ios do
94
104
# push to origin
95
105
sh ( 'git' , 'push' , 'origin' , 'release-v1' )
96
106
end
97
-
107
+
98
108
desc "Tag in git and push to GitHub"
99
109
private_lane :add_tag do |options |
100
110
next_version = options [ :version ]
@@ -136,7 +146,7 @@ platform :ios do
136
146
changelog = options [ :changelog ]
137
147
tag = "#{ version } "
138
148
plugin_root = File . expand_path ( "#{ ENV [ 'CIRCLE_WORKING_DIRECTORY' ] } /AmplifyPlugins" )
139
-
149
+
140
150
sh ( 'bundle' , 'exec' , 'swift' , 'package' , 'update' )
141
151
142
152
sh ( 'bundle' , 'exec' , 'pod' , 'repo' , 'update' )
0 commit comments