diff --git a/appveyor.yml b/appveyor.yml index b36bdb53..783e63a2 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -345,8 +345,7 @@ - ps: $buildversion = Get-Content version.ver - ps: $commitLog = git log -1 --pretty=%B - - - - ps: ./ci/upload_file.ps1 - - ps: ./ci/manual_upload_release.ps1 + + - ps: $errCode = ./ci/upload_file.ps1 + - ps: if($errCode -eq 0){./ci/manual_upload_release.ps1} diff --git a/ci/delete_version.ps1 b/ci/delete_version.ps1 index e54f2d75..838e1be2 100644 --- a/ci/delete_version.ps1 +++ b/ci/delete_version.ps1 @@ -2,5 +2,5 @@ $token="cvAutoTrackTmpToken" $url='http://update.api.weixitianli.com/cvAutoTrack/Version?token='+$token+'?version='+$version -echo $url +Write-Host $url Invoke-RestMethod -Method Put -Uri $url -ContentType 'application/json' \ No newline at end of file diff --git a/ci/upload_file.ps1 b/ci/upload_file.ps1 index 30dc089b..9e8aef1e 100644 --- a/ci/upload_file.ps1 +++ b/ci/upload_file.ps1 @@ -6,7 +6,7 @@ $login_password='iOpEv21kPOt5ZrMqViLKvJJXshh6olNR' $login_api='/api/auth/login' $login_url='http://download.weixitianli.com'+$login_api + '?Username='+$login_username+'&Password='+$login_password $token=(Invoke-RestMethod -Uri $login_url -Method Post).data.token -echo $token +Write-Host $token $upload_api='/api/fs/put' $upload_url='http://download.weixitianli.com'+$upload_api @@ -20,7 +20,13 @@ $upload_headers=@{ 'Content-Length' = $upload_file_length 'file-path' = $upload_path } -Invoke-RestMethod -Uri $upload_url -Method Put -Headers $upload_headers -InFile $upload_file - +try{ + Invoke-RestMethod -Uri $upload_url -Method Put -Headers $upload_headers -InFile $upload_file + return 0 +} +catch{ + Write-Host "Upload Error, Program Stop." + return 504 +} diff --git a/ci/upload_version.ps1 b/ci/upload_version.ps1 index be0e2156..42fbc5a2 100644 --- a/ci/upload_version.ps1 +++ b/ci/upload_version.ps1 @@ -1,17 +1,17 @@ -echo 获取版本号 +Write-Host 获取版本号 git describe --tags | out-file version.ver $version = Get-Content version.ver -echo (Get-Content version.ver) +Write-Host (Get-Content version.ver) 7z a -tZip cvAutoTrack-%APPVEYOR_BUILD_VERSION%.zip $env:MyProjectDir\cvAutoTrack\x64\Compile\cvAutoTrack.dll (Get-FileHash -Path cvAutoTrack-$version.zip -Algorithm MD5).Hash | out-file md5.hash -echo (Get-Content md5.hash) +Write-Host (Get-Content md5.hash) -echo 上传 +Write-Host 上传 curl -L "https://github.com/aoaostar/alidrive-uploader/releases/download/v2.2.1/alidrive_uploader_v2.2.1_windows_amd64.zip" -o alidrive.zip tar -xf alidrive.zip --strip-components 1 | del example.config.yaml Out-File -FilePath config.yaml -InputObject "ali_drive:`t`n drive_id:`t53348742`n refresh_token:`t7e5bc0b6829c40ac97864d937502447a`n root_path:`t/TianLiUpdateService`ndebug:`tfalse`nretry:`t3`ntransfers:`t3" .\alidrive.exe .\cvAutoTrack-$version.zip /cvAutoTrack -echo 推送版本 +Write-Host 推送版本 $version = Get-Content version.ver $buildversion = Get-Content build_version.ver $md5 = Get-Content md5.hash @@ -20,6 +20,6 @@ $commitLog = git log -1 --pretty=%B $token="cvAutoTrackTmpToken" $url='http://update.api.weixitianli.com/cvAutoTrack/Version?token='+$token $body='{"version":"' + $version+'","description":"' + $buildVersion + '","downloadUrl":"http://download.weixitianli.com/d/TianLiUpdateService/cvAutoTrack/cvAutoTrack-' + $version + '.zip","hash":"' + $md5 + '","updateLog":"' + $commitLog + '"}' -echo $url -echo $body +Write-Host $url +Write-Host $body Invoke-RestMethod -Method Post -Uri $url -Body $body -ContentType 'application/json' \ No newline at end of file diff --git a/ci/version.ver b/ci/version.ver new file mode 100644 index 00000000..dfd3a2e0 Binary files /dev/null and b/ci/version.ver differ