forked from Azure/azure-resource-manager-schemas
-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure-pipelines-autogen.yml
86 lines (74 loc) · 2.29 KB
/
azure-pipelines-autogen.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
pr: none
trigger: none
schedules:
- cron: "0 8 * * *"
branches:
include:
- autogenerate
displayName: Daily autogeneration
jobs:
- job: Autogenerate
timeoutInMinutes: 180
pool:
vmImage: 'Ubuntu-16.04'
steps:
- checkout: self
clean: true
- task: DownloadSecureFile@1
name: schemasDeployKey
inputs:
secureFile: schemas_rsa
displayName: "Download GitHub Deploy Key"
- script: |
set -Eeuxo pipefail
mkdir ~/.ssh && mv $(schemasDeployKey.secureFilePath) ~/.ssh/schemas_rsa
chmod 700 ~/.ssh
chmod 600 ~/.ssh/schemas_rsa
git config user.name "Autogenerator Pipeline"
git config user.email "azure-resource-manager-schemas@noreply.github.com"
git config core.sshCommand "ssh -i ~/.ssh/schemas_rsa -F /dev/null"
git remote set-url origin git@github.com:Azure/azure-resource-manager-schemas.git
ssh-keyscan -t rsa github.com >> ~/.ssh/known_hosts
git fetch
displayName: Configure git
- script: |
set -Eeuxo pipefail
git checkout $(Build.SourceBranchName)
git pull
git merge --no-commit --no-ff --strategy-option=theirs origin/master
if ! git diff-index --quiet HEAD --; then
git commit -m "Merge remote-tracking branch 'origin/master' into $(Build.SourceBranchName)"
git push origin $(Build.SourceBranchName)
fi
displayName: Integrate master branch
- script: |
set -Eeuxo pipefail
cd generator
npm install
displayName: 'Install packages'
- script: |
set -Eeuxo pipefail
cd generator
npm run generate-all $(generateParams)
displayName: 'Generate schemas'
- script: |
set -Eeuxo pipefail
git add --all schemas
if ! git diff-index --quiet HEAD --; then
git commit -m "Autogenerate schemas"
git push origin $(Build.SourceBranchName)
fi
displayName: Commit autogenerated schemas
- script: |
set -Eeuxo pipefail
cd generator
npm run list-resources resources.json
displayName: 'List resources'
- script: |
set -Eeuxo pipefail
git add generator/resources.json
if ! git diff-index --quiet HEAD --; then
git commit -m "Update resource list"
git push origin $(Build.SourceBranchName)
fi
displayName: Commit resource list