Skip to content

Commit

Permalink
Merge pull request i-RIC#75 from kskinoue0612/push_to_online_update
Browse files Browse the repository at this point in the history
AppVeyor build push newest iriclib.dll to online_update.
  • Loading branch information
kskinoue0612 authored May 23, 2020
2 parents 39006e6 + f1fa740 commit 456b35d
Showing 1 changed file with 119 additions and 0 deletions.
119 changes: 119 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,16 @@ skip_tags: true
environment:
scharlton2_access_token:
secure: dZo8X7uIxkv0RAieGg6J4zNyILq/3RxgzrI3rf4y3CY4rRHKHasO6FxpKI5USzs9
scharlton2_online_update_access_token:
secure: CS9f7K3/ePypXUjKJ5S5iX2WFLNpC0IH4LEC9jYXdvcNbaM7CFl0fU5Ws/qUDgvo
iric_access_token:
secure: jCnsDz8WNLsiCXa3BhIfDU8A5kRMruC9eUedcWKW7lOKhGGiHZYdRhaaN2cl5UNg
iric_online_update_access_token:
secure: WDcJrM7sx9jagk006F3OtXqomb90MlJcRIs8LoAyvT0wVzvG+UxeaW+oG9GWb1t8
kskinoue0612_access_token:
secure: oVRLqEy3Z23kImxSlNOKZcRwO/R/ZJV202rigsj2IBXGrcm/u0cQHseHr6NS2JGV
kskinoue0612_online_update_access_token:
secure: GzdhhFKWjeLDM22U4ZcrMkAGEEnZLMVbfBR9W8uRQ/LqOtvX2qjPXvC3nvxxWeUc

image:
- Visual Studio 2013
Expand All @@ -29,6 +35,10 @@ init:
- FOR /F "tokens=3 delims= " %%i in ('echo %APPVEYOR_BUILD_WORKER_IMAGE%') do set YEAR=%%i
- echo %YEAR%
- 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"))
- ps: Write-Output $UploadRelease
# Only commit and push to master branch or debug-appveyor branch (for testing)
- 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))
- ps: Write-Output $CommitAndPush

# doesn't seem to be able to use environmental vars
clone_folder: C:\iricdev\lib\src\iriclib-git
Expand Down Expand Up @@ -156,3 +166,112 @@ on_success:
Write-Output "$((($release.Content | ConvertFrom-Json).assets).browser_download_url)"
Get-FileHash "$env:APPVEYOR_BUILD_FOLDER\_artifacts\libs.zip"
}
- ps: |
if ($CommitAndPush) {
# online_update urls
$remote_url_iric = "https://github.com/i-RIC/online_update.git"
$remote_url_scharlton2 = "https://github.com/scharlton2/online_update.git"
$remote_url_kskinoue0612 = "https://github.com/kskinoue0612/online_update.git"
$branch = $True
if ($env:APPVEYOR_REPO_NAME -eq "i-RIC/iriclib") {
$remote_url = $remote_url_iric
$access_token = $env:iric_online_update_access_token
$branch = $False
}
if ($env:APPVEYOR_REPO_NAME -eq "scharlton2/iriclib") {
$remote_url = $remote_url_scharlton2
# online_update_2020_05_17 expires after a year if not used
$access_token = $env:scharlton2_online_update_access_token
}
if ($env:APPVEYOR_REPO_NAME -eq "kskinoue0612/iriclib") {
$remote_url = $remote_url_kskinoue0612
$access_token = $env:kskinoue0612_online_update_access_token
}
Set-Location \ -ErrorAction Stop
git clone -q --branch=master --depth 1 $remote_url online_update 2>&1 | Out-Null
if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) }
Set-Location .\online_update -ErrorAction Stop
if ($branch) {
# create branch when remote is not "i-RIC/prepost-gui"
# branches starting with '__' aren't automatically built by appveyor
git checkout -qb __$env:APPVEYOR_JOB_ID
if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) }
}
# update data\definition.xml and meta\package.xml from dev_src\packages\gui.prepost
$v=(Select-String -Path dev_src\packages\gui.prepost\meta\package.xml -Pattern "(?<=<Version>)(.*)(?=</Version>)").Matches.Value -split "\."
$v[3] = 1 + $v[3]
$env:VERSION = $v -join "."
$tokyo_tz = [System.TimeZoneInfo]::FindSystemTimeZoneById("Tokyo Standard Time")
$tokyo_date = [System.TimeZoneInfo]::ConvertTimeFromUtc((Get-Date).ToUniversalTime(), $tokyo_tz)
$env:RELEASE_DATE = $(Get-Date $tokyo_date -Format s).Substring(0,10)
$env:RELEASE = $env:RELEASE_DATE -replace '-', '.'
$env:CAPTION = "iRIC GUI " + $v[0] + "." + $v[1] + "." + $v[2]
$files=@('dev_src\packages\gui.prepost\data\definition.xml', `
'dev_src\packages\gui.prepost\meta\package.xml')
foreach ($file in $files) {
(Get-Content $file) | Foreach-Object {
$_ -replace "(?<=<Version>)(.*)(?=</Version>)", "$env:VERSION" `
-replace "`" version=`"([^`"]*)`"", "`" version=`"$env:VERSION`"" `
-replace "(?<=<ReleaseDate>)(.*)(?=</ReleaseDate>)", "$env:RELEASE_DATE" `
-replace "release=`"([^`"]*)`"", "release=`"$env:RELEASE`"" `
-replace "caption=`"([^`"]*)`"", "caption=`"$env:CAPTION`"" `
-replace "iriclib-github-sha1=`"([^`"]*)`"", "iriclib-github-sha1=`"$env:APPVEYOR_REPO_COMMIT`""
} | Set-Content $file
}
# distribute iriclib.dll
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
# run repogen to build packages and Updates.xml
Set-Location \online_update\dev_src -ErrorAction Stop
# create qt_ifw_path.py
Write-Output "QT_IFW_PATH = 'C:\\Qt\\Tools\\QtInstallerFramework\\2.0'" | Out-File -FilePath \online_update\dev_src\qt_ifw_path.py -Encoding ascii
# run repogen
py build_update_repository.py
if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) }
# run normalize_updatexml.py to normalize Updates.xml.
Set-Location \online_update -ErrorAction Stop
py normalize_updatexml.py
if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) }
# commit and push to https://github.com/i-RIC/online_update.git
git config --global credential.helper store
if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) }
# configure git for commit and push
Add-Content "$HOME\.git-credentials" "https://$($access_token):x-oauth-basic@github.com`n" -ErrorAction Stop
git config --global user.email "iric.appveyor@gmail.com"
git config --global user.name "iric.appveyor"
git config --global core.safecrlf false
if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) }
git add -A *.7z *.sha1 *.xml *.dll *.exe *.qm
if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) }
# Qt dictionaries are now included in gui.runtime package.
git reset **/qt_*.qm
if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) }
git commit -m "built by iric.appveyor"
if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) }
if ($branch) {
git push --set-upstream origin __$env:APPVEYOR_JOB_ID 2>&1 | Out-Null
} else {
git push --set-upstream origin master 2>&1 | Out-Null
}
if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) }
git status
if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) }
Write-Output "iriclib-github-sha1=`"$env:APPVEYOR_REPO_COMMIT`""
Get-FileHash C:\iricdev\lib\src\iriclib-git\_build_release\INSTALL\lib\iriclib.dll
}

0 comments on commit 456b35d

Please sign in to comment.