Skip to content

Commit a0e72dc

Browse files
committed
Fix build script
1 parent e25df27 commit a0e72dc

2 files changed

Lines changed: 43 additions & 1 deletion

File tree

appveyor.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ install:
2020
Update-AppveyorBuild -Version "$s.$env:APPVEYOR_BUILD_NUMBER"
2121
}
2222
environment:
23+
DeployApiCode:
24+
secure: Umx/zsZC7BVyJ+HNpdOavb3XFgrgfy4P+pZ4PKhrd34=
2325
matrix:
2426
- job_name: build_skip
2527
job_group: build
@@ -101,7 +103,7 @@ deploy:
101103
description: 'Release description'
102104
provider: GitHub
103105
auth_token:
104-
secure: PWzd/WicmutMxrc66FtBXAQMgCUKsX8yjeqv+2SHZyflLOTYZz5393rynVUtCltZ
106+
secure: kECvxcX/55YfR6aAB6FJPlwCeIu3tg6csxq8/s2r011M/maHPc3DJbgMLKPzQr5/
105107
artifact: /.*\.zip/ # upload all zips to release assets
106108
draft: true
107109
prerelease: false

scripts/appveyor-predeploy.ps1

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
$apiUrl = 'https://ci.appveyor.com/api'
2+
$token = "$env:DeployApiCode"
3+
$headers = @{
4+
"Authorization" = "Bearer $token"
5+
"Content-type" = "application/json"
6+
}
7+
$accountName = 'thomas694'
8+
$projectSlug = 'classificationbox-toolkit'
9+
10+
$downloadLocation = "$env:APPVEYOR_BUILD_FOLDER"
11+
$artifactsPath = "$downloadLocation\artifacts"
12+
New-Item -ItemType Directory -Force -Path $artifactsPath
13+
14+
# get project with last build details
15+
$project = Invoke-RestMethod -Method Get -Uri "$apiUrl/projects/$accountName/$projectSlug" -Headers $headers
16+
17+
foreach($job in $project.build.jobs)
18+
{
19+
# get this job id
20+
$jobId = $job.jobId
21+
if ($jobId -eq "$env:APPVEYOR_JOB_ID") { continue }
22+
23+
# get job artifacts (just to see what we've got)
24+
$artifacts = Invoke-RestMethod -Method Get -Uri "$apiUrl/buildjobs/$jobId/artifacts" -Headers $headers
25+
26+
foreach($artifact in $artifacts)
27+
{
28+
$artifactFileName = $artifact.fileName
29+
30+
# artifact will be downloaded as
31+
$localArtifactPath = "$downloadLocation\$artifactFileName"
32+
33+
# download artifact
34+
# -OutFile - is local file name where artifact will be downloaded into
35+
# the Headers in this call should only contain the bearer token, and no Content-type, otherwise it will fail!
36+
Invoke-RestMethod -Method Get -Uri "$apiUrl/buildjobs/$jobId/artifacts/$artifactFileName" `
37+
-OutFile $localArtifactPath -Headers @{ "Authorization" = "Bearer $token" }
38+
}
39+
}
40+
Get-ChildItem "$artifactsPath\*.zip" | % { Push-AppveyorArtifact $_.FullName -FileName $_.Name }

0 commit comments

Comments
 (0)