Skip to content

Commit

Permalink
Merge pull request #589 from bothzoli/fix/github-asset-upload
Browse files Browse the repository at this point in the history
Fix GitHub asset upload on releases
  • Loading branch information
vkhorikov authored Dec 28, 2024
2 parents 4c0dd5b + fe928a7 commit d497ab7
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ stages:
releaseInfo: $[ dependencies.Version.outputs['readNewVersionStep.releaseInfo'] ]
newVersion: $[ dependencies.Version.outputs['readNewVersionStep.newVersion'] ]
currentVersion: $[ dependencies.Version.outputs['readCurrentVersionStep.currentVersion'] ]
acceptHeader: 'Accept: application/vnd.github+json'
apiVersionHeader: 'X-GitHub-Api-Version: 2022-11-28'
contentTypeHeader1: 'Content-Type: application/json'
contentTypeHeader2: 'Content-Type: application/octet-stream'
authHeader: 'Authorization: Bearer $(gitHubToken)'
Expand All @@ -104,8 +106,8 @@ stages:
curl -X POST -s -H '$(contentTypeHeader1)' -H '$(authHeader)' https://api.github.com/repos/vkhorikov/CSharpFunctionalExtensions/releases -d '$(createReleaseRequest)'
$json = Invoke-RestMethod -Method 'GET' -Uri "https://api.github.com/repos/vkhorikov/CSharpFunctionalExtensions/releases/latest"
$releaseId = $json.id
curl -X POST -s -H '$(contentTypeHeader2)' -H '$(authHeader)' --data-binary '$(Pipeline.Workspace)/NuGetPackage/CSharpFunctionalExtensions.$(newVersion).nupkg' 'https://uploads.github.com/repos/vkhorikov/CSharpFunctionalExtensions/releases/$(releaseId)/assets?name=CSharpFunctionalExtensions.$(newVersion).nupkg'
curl -X POST -s -H '$(contentTypeHeader2)' -H '$(authHeader)' --data-binary '$(Pipeline.Workspace)/NuGetPackageStrongName/CSharpFunctionalExtensions.StrongName.$(newVersion).nupkg' 'https://uploads.github.com/repos/vkhorikov/CSharpFunctionalExtensions/releases/$(releaseId)/assets?name=CSharpFunctionalExtensions.StrongName.$(newVersion).nupkg'
curl -X POST -s -H '$(acceptHeader)' -H '$(apiVersionHeader)' -H '$(contentTypeHeader2)' -H '$(authHeader)' --data-binary '@$(Pipeline.Workspace)/NuGetPackage/CSharpFunctionalExtensions.$(newVersion).nupkg' 'https://uploads.github.com/repos/vkhorikov/CSharpFunctionalExtensions/releases/$(releaseId)/assets?name=CSharpFunctionalExtensions.$(newVersion).nupkg'
curl -X POST -s -H '$(acceptHeader)' -H '$(apiVersionHeader)' -H '$(contentTypeHeader2)' -H '$(authHeader)' --data-binary '@$(Pipeline.Workspace)/NuGetPackageStrongName/CSharpFunctionalExtensions.StrongName.$(newVersion).nupkg' 'https://uploads.github.com/repos/vkhorikov/CSharpFunctionalExtensions/releases/$(releaseId)/assets?name=CSharpFunctionalExtensions.StrongName.$(newVersion).nupkg'
displayName: Publish to GitHub
condition: and(succeeded(), ne(variables.gitHubToken, ''))
Expand Down

0 comments on commit d497ab7

Please sign in to comment.