diff --git a/script/vsts/platforms/linux.yml b/script/vsts/platforms/linux.yml index daa68177e..c69af3196 100644 --- a/script/vsts/platforms/linux.yml +++ b/script/vsts/platforms/linux.yml @@ -59,26 +59,15 @@ jobs: testRunTitle: Linux condition: ne(variables['Atom.SkipTests'], 'true') - - task: PublishBuildArtifacts@1 - inputs: - PathtoPublish: $(Build.SourcesDirectory)/out/atom.x86_64.rpm - ArtifactName: atom.x86_64.rpm - ArtifactType: Container - displayName: Upload atom.x84_64.rpm - condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest')) - - - task: PublishBuildArtifacts@1 - inputs: - PathtoPublish: $(Build.SourcesDirectory)/out/atom-amd64.deb - ArtifactName: atom-amd64.deb - ArtifactType: Container - displayName: Upload atom-amd64.deb - condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest')) - - - task: PublishBuildArtifacts@1 - inputs: - PathtoPublish: $(Build.SourcesDirectory)/out/atom-amd64.tar.gz - ArtifactName: atom-amd64.tar.gz - ArtifactType: Container - displayName: Upload atom-amd64.tar.gz - condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest')) + - template: templates/publish.yml + parameters: + artifacts: + - fileName: atom.x86_64.rpm + fileDir: $(Build.SourcesDirectory)/out + condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest')) + - fileName: atom-amd64.deb + fileDir: $(Build.SourcesDirectory)/out + condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest')) + - fileName: atom-amd64.tar.gz + fileDir: $(Build.SourcesDirectory)/out + condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest')) diff --git a/script/vsts/platforms/macos.yml b/script/vsts/platforms/macos.yml index fd475a62e..8ee018dc7 100644 --- a/script/vsts/platforms/macos.yml +++ b/script/vsts/platforms/macos.yml @@ -46,29 +46,18 @@ jobs: cp $(Build.SourcesDirectory)/out/*.zip $(Build.ArtifactStagingDirectory) displayName: Stage Artifacts - - task: PublishBuildArtifacts@1 - inputs: - PathtoPublish: $(Build.ArtifactStagingDirectory)/atom-mac.zip - ArtifactName: atom-mac.zip - ArtifactType: Container - displayName: Upload atom-mac.zip - condition: succeeded() - - - task: PublishBuildArtifacts@1 - inputs: - PathtoPublish: $(Build.ArtifactStagingDirectory)/atom-mac-symbols.zip - ArtifactName: atom-mac-symbols.zip - ArtifactType: Container - displayName: Upload atom-mac-symbols.zip - condition: succeeded() - - - task: PublishBuildArtifacts@1 - inputs: - PathtoPublish: $(Build.SourcesDirectory)/docs/output/atom-api.json - ArtifactName: atom-api.json - ArtifactType: Container - displayName: Upload atom-api.json - condition: succeeded() + - template: templates/publish.yml + parameters: + artifacts: + - fileName: atom-mac.zip + fileDir: $(Build.ArtifactStagingDirectory) + condition: succeeded() + - fileName: atom-mac-symbols.zip + fileDir: $(Build.ArtifactStagingDirectory) + condition: succeeded() + - fileName: atom-api.json + fileDir: $(Build.SourcesDirectory)/docs/output + condition: succeeded() - job: macOS_tests displayName: macOS test diff --git a/script/vsts/platforms/templates/publish.yml b/script/vsts/platforms/templates/publish.yml new file mode 100644 index 000000000..d97c402bf --- /dev/null +++ b/script/vsts/platforms/templates/publish.yml @@ -0,0 +1,21 @@ +parameters: + - name: artifacts + type: object + # artifacts is an array with each element having these properties: + # - fileName + # - fileDir + # - condition + # - continueOnError + +steps: + - ${{ each artifact in parameters.artifacts }}: + - task: PublishBuildArtifacts@1 + inputs: + PathtoPublish: ${{artifact.fileDir}}/${{artifact.fileName}} + ArtifactName: ${{artifact.fileName}} + ArtifactType: Container + displayName: Upload ${{artifact.fileName}} + ${{ if artifact.condition }}: + condition: ${{artifact.condition}} + ${{ if artifact.continueOnError }}: + continueOnError: ${{artifact.continueOnError}} diff --git a/script/vsts/platforms/windows.yml b/script/vsts/platforms/windows.yml index 6d31c2d7f..026bee398 100644 --- a/script/vsts/platforms/windows.yml +++ b/script/vsts/platforms/windows.yml @@ -122,84 +122,33 @@ jobs: displayName: Upload crash reports to S3 on release branch condition: and(failed(), ne(variables['ATOM_RELEASES_S3_KEY'], '')) - - task: PublishBuildArtifacts@1 - inputs: - PathtoPublish: $(Build.SourcesDirectory)/out/atom-x64-windows.zip - ArtifactName: atom-x64-windows.zip - ArtifactType: Container - displayName: Upload atom-x64-windows.zip - condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest'), eq(variables['buildArch'], 'x64')) + - pwsh: | + if ($env:BUILD_ARCH -eq "x64") { + $env:FileID="-x64" + } else { + $env:FileID="" + } + echo "##vso[task.setvariable variable=FileID]$env:FileID" # Azure syntax + env: + BUILD_ARCH: $(buildArch) + displayName: Set FileID based on the arch - - task: PublishBuildArtifacts@1 - inputs: - PathtoPublish: $(Build.SourcesDirectory)/out/AtomSetup-x64.exe - ArtifactName: AtomSetup-x64.exe - ArtifactType: Container - displayName: Upload AtomSetup-x64.exe - condition: and(succeeded(), eq(variables['IsReleaseBranch'], 'true'), eq(variables['buildArch'], 'x64')) - - - task: PublishBuildArtifacts@1 - inputs: - PathtoPublish: $(Build.SourcesDirectory)/out/$(AppName)-x64-$(ReleaseVersion)-full.nupkg - ArtifactName: $(AppName)-x64-$(ReleaseVersion)-full.nupkg - ArtifactType: Container - displayName: Upload $(AppName)-x64-$(ReleaseVersion)-full.nupkg - condition: and(succeeded(), eq(variables['IsReleaseBranch'], 'true'), eq(variables['buildArch'], 'x64')) - - - task: PublishBuildArtifacts@1 - inputs: - PathtoPublish: $(Build.SourcesDirectory)/out/$(AppName)-x64-$(ReleaseVersion)-delta.nupkg - ArtifactName: $(AppName)-x64-$(ReleaseVersion)-delta.nupkg - ArtifactType: Container - displayName: Upload $(AppName)-x64-$(ReleaseVersion)-delta.nupkg - condition: and(succeeded(), eq(variables['IsReleaseBranch'], 'true'), eq(variables['buildArch'], 'x64')) - continueOnError: true # Nightly builds don't produce delta packages yet, so don't fail the build - - - task: PublishBuildArtifacts@1 - inputs: - PathtoPublish: $(Build.SourcesDirectory)/out/RELEASES-x64 - ArtifactName: RELEASES-x64 - ArtifactType: Container - displayName: Upload RELEASES-x64 - condition: and(succeeded(), eq(variables['IsReleaseBranch'], 'true'), eq(variables['buildArch'], 'x64')) - - - task: PublishBuildArtifacts@1 - inputs: - PathtoPublish: $(Build.SourcesDirectory)/out/atom-windows.zip - ArtifactName: atom-windows.zip - ArtifactType: Container - displayName: Upload atom-windows.zip - condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest'), eq(variables['buildArch'], 'x86')) - - - task: PublishBuildArtifacts@1 - inputs: - PathtoPublish: $(Build.SourcesDirectory)/out/AtomSetup.exe - ArtifactName: AtomSetup.exe - ArtifactType: Container - displayName: Upload AtomSetup.exe - condition: and(succeeded(), eq(variables['IsReleaseBranch'], 'true'), eq(variables['buildArch'], 'x86')) - - - task: PublishBuildArtifacts@1 - inputs: - PathtoPublish: $(Build.SourcesDirectory)/out/$(AppName)-$(ReleaseVersion)-full.nupkg - ArtifactName: $(AppName)-$(ReleaseVersion)-full.nupkg - ArtifactType: Container - displayName: Upload $(AppName)-$(ReleaseVersion)-full.nupkg - condition: and(succeeded(), eq(variables['IsReleaseBranch'], 'true'), eq(variables['buildArch'], 'x86')) - - - task: PublishBuildArtifacts@1 - inputs: - PathtoPublish: $(Build.SourcesDirectory)/out/$(AppName)-$(ReleaseVersion)-delta.nupkg - ArtifactName: $(AppName)-$(ReleaseVersion)-delta.nupkg - ArtifactType: Container - displayName: Upload $(AppName)-$(ReleaseVersion)-delta.nupkg - condition: and(succeeded(), eq(variables['IsReleaseBranch'], 'true'), eq(variables['buildArch'], 'x86')) - continueOnError: true # Nightly builds don't produce delta packages yet, so don't fail the build - - - task: PublishBuildArtifacts@1 - inputs: - PathtoPublish: $(Build.SourcesDirectory)/out/RELEASES - ArtifactName: RELEASES - ArtifactType: Container - displayName: Upload RELEASES - condition: and(succeeded(), eq(variables['IsReleaseBranch'], 'true'), eq(variables['buildArch'], 'x86')) + - template: templates/publish.yml + parameters: + artifacts: + - fileName: atom$(FileID)-windows.zip + fileDir: $(Build.SourcesDirectory)/out + condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest')) + - fileName: AtomSetup$(FileID).exe + fileDir: $(Build.SourcesDirectory)/out + condition: and(succeeded(), eq(variables['IsReleaseBranch'], 'true')) + - fileName: $(AppName)$(FileID)-$(ReleaseVersion)-full.nupkg + fileDir: $(Build.SourcesDirectory)/out + condition: and(succeeded(), eq(variables['IsReleaseBranch'], 'true')) + - fileName: $(AppName)$(FileID)-$(ReleaseVersion)-delta.nupkg + fileDir: $(Build.SourcesDirectory)/out + condition: and(succeeded(), eq(variables['IsReleaseBranch'], 'true')) + continueOnError: true # Nightly builds don't produce delta packages yet, so don't fail the build + - fileName: RELEASES$(FileID) + fileDir: $(Build.SourcesDirectory)/out + condition: and(succeeded(), eq(variables['IsReleaseBranch'], 'true'))