forked from OneIdentity/safeguard-bash
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild-publish.yml
50 lines (50 loc) · 1.86 KB
/
build-publish.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
variables:
- template: pipeline-templates/global-variables.yml
trigger:
branches:
include:
- master
- release-*
paths:
exclude:
- README.md
pr: none
jobs:
- job: Build
displayName: "Build and publish Linux Docker images, publish GitHub zip"
pool:
vmImage: 'ubuntu-latest'
steps:
- template: pipeline-templates/build-steps.yml
- task: GitHubRelease@1
inputs:
gitHubConnection: 'github.ReleaseServiceAccount'
repositoryName: 'OneIdentity/safeguard-bash'
action: 'create'
target: '$(Build.SourceVersion)'
tagSource: 'userSpecifiedTag'
tag: 'release-$(VersionString)'
title: '$(VersionString)'
isPreRelease: $(isPrerelease)
changeLogCompareToRelease: 'lastFullRelease'
changeLogType: 'commitBased'
assets: $(Build.ArtifactStagingDirectory)/*.zip
displayName: 'Creating and publishing a release to Github'
- task: AzureKeyVault@1
inputs:
azureSubscription: 'OneIdentity.RD.SBox.Safeguard-ServiceConnection'
KeyVaultName: 'SafeguardBuildSecrets'
SecretsFilter: 'DockerHubAccessToken,DockerHubPassword'
displayName: 'Get Docker Hub Access Token from Sandbox Azure Key Vault'
condition: and( succeeded(), eq( variables.shouldPublishDocker, true ) )
- task: Bash@3
inputs:
targetType: 'inline'
failOnStderr: true
script: |
docker login -u petrsnd --password-stdin <<<$(DockerHubAccessToken) 2>/dev/null
docker push oneidentity/safeguard-bash:$(VersionString)-alpine
docker push oneidentity/safeguard-bash:latest
docker logout
condition: and( succeeded(), eq(variables.shouldPublishDocker, true) )
displayName: 'Pushing Linux Docker images to Docker Hub'