Feature: Don't duplicate docker build and include package version in tag (#35)

This commit is contained in:
Timothee Guerin 2019-06-04 14:52:46 -07:00 коммит произвёл GitHub
Родитель cf348a397d
Коммит 48a83057e8
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
2 изменённых файлов: 15 добавлений и 13 удалений

Просмотреть файл

@ -3,33 +3,34 @@ trigger:
pr: none
stages:
- stage: Build_Docker
jobs:
- job: Build_Docker
displayName: Build and publish to hub.docker.com
pool:
vmImage: "Ubuntu-16.04"
variables:
build_counter: $[counter('versioncounter', 1)]
steps:
- script: |
version=$(npm run -s get-version)
echo "Current package version is $version"
echo "Current build number is $(build_counter)"
echo "##vso[build.updatebuildnumber]$version.$(build_counter)"
echo "##vso[task.setvariable variable=NpmVersion]$version"
displayName: Resolve package version
- task: Docker@2
displayName: "Build azuredevx/git-rest-api"
inputs:
containerRegistry: "git-rest-api docker"
repository: "azuredevx/git-rest-api"
tags: |
$(Build.BuildId)
$(Build.BuildNumber)
$(NpmVersion)-latest
latest
- stage: Publish_Docker
dependsOn: Build_Docker
jobs:
- job: Publish_Docker
pool:
vmImage: "Ubuntu-16.04"
steps:
- task: Docker@2
displayName: "Push azuredevx/git-rest-api"
inputs:
containerRegistry: "git-rest-api docker"
repository: "azuredevx/git-rest-api"
- stage: build_sdks
displayName: Build SDKs

Просмотреть файл

@ -4,6 +4,7 @@
"description": "This project welcomes contributions and suggestions. Most contributions require you to agree to a\r Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us\r the rights to use your contribution. For details, visit https://cla.microsoft.com.",
"main": "bin/main.js",
"scripts": {
"get-version": "echo $npm_package_version",
"build": "tsc -p config/tsconfig.build.json",
"build:watch": "npm run -s build -- --watch",
"start": "npm run build && node ./bin/main.js",