forked from OpenTTD/website
-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure-pipelines.yml
44 lines (39 loc) · 1.33 KB
/
azure-pipelines.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
pr:
- master
trigger:
branches:
include:
- refs/heads/master
- refs/tags/*
jobs:
- job: BuildImage
displayName: 'Build image'
pool:
vmImage: 'ubuntu-16.04'
steps:
- checkout: self
submodules: true
# Only update the BuildNumber on 'master' (and not on a Pull Request)
- script: |
set -e
VERSION=$(git describe --tags)
DATE=$(date +%Y%m%d-%H%M)
echo "${VERSION}-${DATE}"
echo "##vso[build.updatebuildnumber]${VERSION}-${DATE}"
condition: and(succeeded(), or(eq(variables['Build.SourceBranch'], 'refs/heads/master'), contains(variables['Build.SourceBranch'], 'refs/tags/')))
displayName: 'Use "git describe" as BuildNumber'
- task: Docker@1
displayName: 'Build image'
inputs:
dockerFile: Dockerfile
imageName: 'openttd/website:$(Build.BuildNumber)'
addDefaultLabels: false
# Only publish when it triggered on 'master' (and not on a Pull Request)
- task: Docker@1
condition: and(succeeded(), or(eq(variables['Build.SourceBranch'], 'refs/heads/master'), contains(variables['Build.SourceBranch'], 'refs/tags/')))
displayName: 'Publish image'
inputs:
containerregistrytype: 'Container Registry'
dockerRegistryEndpoint: 'OpenTTD Docker Hub'
command: 'Push an image'
imageName: 'openttd/website:$(Build.BuildNumber)'