@@ -6,10 +6,16 @@ skip_tags: true
6
6
environment :
7
7
scharlton2_access_token :
8
8
secure : dZo8X7uIxkv0RAieGg6J4zNyILq/3RxgzrI3rf4y3CY4rRHKHasO6FxpKI5USzs9
9
+ scharlton2_online_update_access_token :
10
+ secure : CS9f7K3/ePypXUjKJ5S5iX2WFLNpC0IH4LEC9jYXdvcNbaM7CFl0fU5Ws/qUDgvo
9
11
iric_access_token :
10
12
secure : jCnsDz8WNLsiCXa3BhIfDU8A5kRMruC9eUedcWKW7lOKhGGiHZYdRhaaN2cl5UNg
13
+ iric_online_update_access_token :
14
+ secure : WDcJrM7sx9jagk006F3OtXqomb90MlJcRIs8LoAyvT0wVzvG+UxeaW+oG9GWb1t8
11
15
kskinoue0612_access_token :
12
16
secure : oVRLqEy3Z23kImxSlNOKZcRwO/R/ZJV202rigsj2IBXGrcm/u0cQHseHr6NS2JGV
17
+ kskinoue0612_online_update_access_token :
18
+ secure : GzdhhFKWjeLDM22U4ZcrMkAGEEnZLMVbfBR9W8uRQ/LqOtvX2qjPXvC3nvxxWeUc
13
19
14
20
image :
15
21
- Visual Studio 2013
29
35
- FOR /F "tokens=3 delims= " %%i in ('echo %APPVEYOR_BUILD_WORKER_IMAGE%') do set YEAR=%%i
30
36
- echo %YEAR%
31
37
- ps : $UploadRelease = (($env:Configuration -eq "Release") -AND ($env:APPVEYOR_REPO_BRANCH -eq "master") -AND (!$env:APPVEYOR_PULL_REQUEST_NUMBER) -AND ($env:SGEN -eq "vs2013-x64"))
38
+ - ps : Write-Output $UploadRelease
39
+ # Only commit and push to master branch or debug-appveyor branch (for testing)
40
+ - ps : $CommitAndPush = (($env:Configuration -eq "Release") -AND ($env:APPVEYOR_BUILD_WORKER_IMAGE -eq "Visual Studio 2013") -AND (($env:APPVEYOR_REPO_BRANCH -eq "master") -OR ($env:APPVEYOR_REPO_BRANCH -eq "push_to_online_update")) -AND (!$env:APPVEYOR_PULL_REQUEST_NUMBER))
41
+ - ps : Write-Output $CommitAndPush
32
42
33
43
# doesn't seem to be able to use environmental vars
34
44
clone_folder : C:\iricdev\lib\src\iriclib-git
@@ -156,3 +166,112 @@ on_success:
156
166
Write-Output "$((($release.Content | ConvertFrom-Json).assets).browser_download_url)"
157
167
Get-FileHash "$env:APPVEYOR_BUILD_FOLDER\_artifacts\libs.zip"
158
168
}
169
+
170
+ - ps : |
171
+ if ($CommitAndPush) {
172
+ # online_update urls
173
+ $remote_url_iric = "https://github.com/i-RIC/online_update.git"
174
+ $remote_url_scharlton2 = "https://github.com/scharlton2/online_update.git"
175
+ $remote_url_kskinoue0612 = "https://github.com/kskinoue0612/online_update.git"
176
+
177
+ $branch = $True
178
+ if ($env:APPVEYOR_REPO_NAME -eq "i-RIC/iriclib") {
179
+ $remote_url = $remote_url_iric
180
+ $access_token = $env:iric_online_update_access_token
181
+ $branch = $False
182
+ }
183
+ if ($env:APPVEYOR_REPO_NAME -eq "scharlton2/iriclib") {
184
+ $remote_url = $remote_url_scharlton2
185
+ # online_update_2020_05_17 expires after a year if not used
186
+ $access_token = $env:scharlton2_online_update_access_token
187
+ }
188
+ if ($env:APPVEYOR_REPO_NAME -eq "kskinoue0612/iriclib") {
189
+ $remote_url = $remote_url_kskinoue0612
190
+ $access_token = $env:kskinoue0612_online_update_access_token
191
+ }
192
+
193
+ Set-Location \ -ErrorAction Stop
194
+ git clone -q --branch=master --depth 1 $remote_url online_update 2>&1 | Out-Null
195
+ if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) }
196
+
197
+ Set-Location .\online_update -ErrorAction Stop
198
+
199
+ if ($branch) {
200
+ # create branch when remote is not "i-RIC/prepost-gui"
201
+ # branches starting with '__' aren't automatically built by appveyor
202
+ git checkout -qb __$env:APPVEYOR_JOB_ID
203
+ if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) }
204
+ }
205
+
206
+ # update data\definition.xml and meta\package.xml from dev_src\packages\gui.prepost
207
+ $v=(Select-String -Path dev_src\packages\gui.prepost\meta\package.xml -Pattern "(?<=<Version>)(.*)(?=</Version>)").Matches.Value -split "\."
208
+ $v[3] = 1 + $v[3]
209
+ $env:VERSION = $v -join "."
210
+ $tokyo_tz = [System.TimeZoneInfo]::FindSystemTimeZoneById("Tokyo Standard Time")
211
+ $tokyo_date = [System.TimeZoneInfo]::ConvertTimeFromUtc((Get-Date).ToUniversalTime(), $tokyo_tz)
212
+ $env:RELEASE_DATE = $(Get-Date $tokyo_date -Format s).Substring(0,10)
213
+ $env:RELEASE = $env:RELEASE_DATE -replace '-', '.'
214
+ $env:CAPTION = "iRIC GUI " + $v[0] + "." + $v[1] + "." + $v[2]
215
+ $files=@('dev_src\packages\gui.prepost\data\definition.xml', `
216
+ 'dev_src\packages\gui.prepost\meta\package.xml')
217
+ foreach ($file in $files) {
218
+ (Get-Content $file) | Foreach-Object {
219
+ $_ -replace "(?<=<Version>)(.*)(?=</Version>)", "$env:VERSION" `
220
+ -replace "`" version=`"([^`"]*)`"", "`" version=`"$env:VERSION`"" `
221
+ -replace "(?<=<ReleaseDate>)(.*)(?=</ReleaseDate>)", "$env:RELEASE_DATE" `
222
+ -replace "release=`"([^`"]*)`"", "release=`"$env:RELEASE`"" `
223
+ -replace "caption=`"([^`"]*)`"", "caption=`"$env:CAPTION`"" `
224
+ -replace "iriclib-github-sha1=`"([^`"]*)`"", "iriclib-github-sha1=`"$env:APPVEYOR_REPO_COMMIT`""
225
+ } | Set-Content $file
226
+ }
227
+
228
+ # distribute iriclib.dll
229
+ Copy-Item C:\iricdev\lib\src\iriclib-git\_build_release\INSTALL\lib\iriclib.dll \online_update\dev_src\packages\gui.prepost\data\iriclib.dll -ErrorAction Stop
230
+
231
+ # run repogen to build packages and Updates.xml
232
+ Set-Location \online_update\dev_src -ErrorAction Stop
233
+ # create qt_ifw_path.py
234
+ Write-Output "QT_IFW_PATH = 'C:\\Qt\\Tools\\QtInstallerFramework\\2.0'" | Out-File -FilePath \online_update\dev_src\qt_ifw_path.py -Encoding ascii
235
+ # run repogen
236
+ py build_update_repository.py
237
+ if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) }
238
+
239
+ # run normalize_updatexml.py to normalize Updates.xml.
240
+ Set-Location \online_update -ErrorAction Stop
241
+ py normalize_updatexml.py
242
+ if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) }
243
+
244
+ # commit and push to https://github.com/i-RIC/online_update.git
245
+ git config --global credential.helper store
246
+ if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) }
247
+
248
+ # configure git for commit and push
249
+ Add-Content "$HOME\.git-credentials" "https://$($access_token):x-oauth-basic@github.com`n" -ErrorAction Stop
250
+ git config --global user.email "iric.appveyor@gmail.com"
251
+ git config --global user.name "iric.appveyor"
252
+ git config --global core.safecrlf false
253
+ if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) }
254
+
255
+ git add -A *.7z *.sha1 *.xml *.dll *.exe *.qm
256
+ if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) }
257
+
258
+ # Qt dictionaries are now included in gui.runtime package.
259
+ git reset **/qt_*.qm
260
+ if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) }
261
+
262
+ git commit -m "built by iric.appveyor"
263
+ if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) }
264
+
265
+ if ($branch) {
266
+ git push --set-upstream origin __$env:APPVEYOR_JOB_ID 2>&1 | Out-Null
267
+ } else {
268
+ git push --set-upstream origin master 2>&1 | Out-Null
269
+ }
270
+ if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) }
271
+
272
+ git status
273
+ if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) }
274
+
275
+ Write-Output "iriclib-github-sha1=`"$env:APPVEYOR_REPO_COMMIT`""
276
+ Get-FileHash C:\iricdev\lib\src\iriclib-git\_build_release\INSTALL\lib\iriclib.dll
277
+ }
0 commit comments