forked from realm/realm-swift
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jenkinsfile.publish
187 lines (174 loc) · 4.71 KB
/
Jenkinsfile.publish
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
def carthageXcodeVersion = '14.3.1'
def prepareWorkspace() {
deleteDir()
unstash 'source'
sh 'unzip source.zip'
}
pipeline {
agent { label 'osx' }
parameters {
string(name: 'branch', defaultValue: 'master')
string(name: 'version', defaultValue: '')
}
environment {
REALM_XCODE_VERSION = "${carthageXcodeVersion}"
}
stages {
stage('Gather Info') {
agent { label 'osx' }
steps {
deleteDir()
copyArtifacts projectName: 'cocoa-pipeline', selector: lastCompleted()
// Restash the artifacts we'll use in later steps rather than using
// copyArtifacts again to avoid problems if cocoa-pipeline is running
// at the same time as this job
stash name: 'source', includes: 'source.zip'
stash name: 'docs', includes: 'realm-docs.zip'
stash name: 'binary', includes: 'realm-swift-*.zip,Carthage.xcframework.zip,*.spm.zip'
sh 'unzip source.zip'
script {
env.version = sh(script: "sed -n 's/^VERSION=\\(.*\\)\$/\\1/p' dependencies.list", returnStdout: true).trim()
}
}
}
stage('Tag and publish docs') {
parallel {
stage('Tag release') {
agent { label 'osx' }
steps {
prepareWorkspace()
sh "./build.sh publish-tag ${branch}"
}
}
stage('Publish docs') {
agent { label 'osx' }
steps {
prepareWorkspace()
unstash 'docs'
withAWS(credentials: 'cocoa-docs-s3-bucket', region: 'us-east-1') {
sh './build.sh publish-docs'
}
}
}
}
}
stage('Create Github and Cocoapods releases') {
parallel {
stage('Create Github Release') {
environment {
GITHUB_ACCESS_TOKEN = credentials('github-release-token')
}
agent { label 'osx' }
steps {
prepareWorkspace()
dir('build') {
unstash 'binary'
}
sh './build.sh publish-github'
}
}
stage('Publish CocoaPods') {
environment {
COCOAPODS_TRUNK_TOKEN = credentials('cocoapods-trunk-token')
}
agent { label 'osx' }
steps {
prepareWorkspace()
sh "./build.sh publish-cocoapods v${env.version}"
}
}
stage('Update update checker') {
agent { label 'osx' }
steps {
prepareWorkspace()
withCredentials([file(credentialsId: 'c0cc8f9e-c3f1-4e22-b22f-6568392e26ae', variable: 'S3CMD_CONFIG')]) {
sh './build.sh publish-update-checker'
}
}
}
}
}
stage('Test release') {
matrix {
axes {
axis {
name 'platform'
values 'ios', 'osx', 'watchos', 'tvos', 'catalyst'
}
axis {
name 'method'
values 'xcframework', 'cocoapods', 'carthage', 'spm'
}
axis {
name 'linkage'
values 'static', 'dynamic'
}
}
excludes {
// Carthage is always dynamic
exclude {
axis {
name 'linkage'
values 'static'
}
axis {
name 'method'
values 'carthage'
}
}
// Static XCFramework is iOS-only
exclude {
axis {
name 'linkage'
values 'static'
}
axis {
name 'method'
values 'xcframework'
}
axis {
name 'platform'
values 'osx', 'watchos', 'catalyst', 'tvos', 'visionos'
}
}
// Catalyst is not supported with Carthage
exclude {
axis {
name 'platform'
values 'catalyst'
}
axis {
name 'method'
values 'carthage'
}
}
// visionOS is not supported with Carthage or CocoaPods
exclude {
axis {
name 'platform'
values 'visionos'
}
axis {
name 'method'
values 'carthage', 'cocoapods'
}
}
}
stages {
stage('test') {
agent { label 'osx' }
environment {
REALM_TEST_RELEASE = "${env.version}"
}
steps {
prepareWorkspace()
dir('examples/installation') {
sh "./build.rb ${platform} ${method} ${linkage}"
}
}
}
}
}
}
}
}