-
-
Notifications
You must be signed in to change notification settings - Fork 26
/
azure-pipelines.yml
117 lines (95 loc) · 3.41 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
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
trigger:
branches:
include:
- master
paths:
exclude:
- /*.md
- .gitignore
pr:
branches:
include:
- master
autoCancel: true
# add nf-tools repo to resources (for Azure Pipelines templates)
resources:
repositories:
- repository: templates
type: github
name: nanoframework/nf-tools
endpoint: nanoFramework
jobs:
##############################
- job: Get_Build_Options
pool:
vmImage: 'windows-latest'
steps:
- checkout: self
# check which project(s) have changed
- powershell: |
git config --global user.email "nfbot"
git config --global user.name "[email protected]"
$auth = "basic $([System.Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes(":$(GitHubToken)"))))"
$commit = Invoke-RestMethod -Uri "https://api.github.com/repos/nanoframework/nf-Community-Contributions/commits/$(Build.SourceVersion)" -Header @{"Authorization"="$auth"} -ContentType "application/json" -Method GET
Write-host "Files changed:"
$commit.files | % {$_.filename}
if ( $commit.files.filename -like "*extensions/stm32/gpiocontroller*" )
{
echo "##vso[task.setvariable variable=BUILD_STM32_GPIOCONTROLLER;isOutput=true]true"
}
name: BuildOptions
displayName: get list of changed paths
# build jobs
# STM32 GpioController extension
- job: Build_STM32_GpioController
# skip build if there are no changes
condition: eq( dependencies.Get_Build_Options.outputs['BuildOptions.BUILD_STM32_GPIOCONTROLLER'], true )
dependsOn:
- Get_Build_Options
pool:
vmImage: 'windows-latest'
variables:
major: 1
# creates a counter called versioncounter and assigns it to the minor variable
minor: $[counter('versioncounter', 0)]
steps:
- checkout: self
- template: azure-pipelines-templates/install-nuget.yml@templates
- task: NuGetCommand@2
inputs:
command: 'custom'
arguments: 'pack extensions\stm32\gpiocontroller\package.nuspec -Version $(major).$(minor)'
condition: succeeded()
displayName: Pack NuGet with class library
- task: CopyFiles@1
inputs:
sourceFolder: $(Build.SourcesDirectory)
Contents: |
**\*nanoFramework.Extensions.Stm32.GpioController*.nupkg
TargetFolder: '$(Build.ArtifactStagingDirectory)'
flattenFolders: true
condition: succeeded()
displayName: Collecting deployable artifacts
# publish artifacts (only possible if this is not a PR originated on a fork)
- task: PublishBuildArtifacts@1
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)'
ArtifactName: deployables
ArtifactType: Container
condition: and( succeeded(), ne(variables['system.pullrequest.isfork'], true) )
displayName: Publish deployables artifacts
# push NuGet class lib package to NuGet (always happens except on PR builds)
- task: NuGetCommand@2
inputs:
command: push
nuGetFeedType: external
packagesToPush: '$(Build.ArtifactStagingDirectory)/*.nupkg'
publishFeedCredentials: 'NuGetEcloSolutions'
condition: and( succeeded(), not( startsWith(variables['Build.SourceBranch'], 'refs/pull') ) )
displayName: Push NuGet packages to NuGet
# step from template @ nf-tools repo
- template: azure-pipelines-templates/discord-webhook-task.yml@templates
parameters:
status: 'failure'
webhookUrl: '$(DiscordWebhook)'
message: 'SMT32 GpioController extension'