Skip to content

Commit c818c69

Browse files
committed
Work CD-CI
- Replace pull request condition check. Signed-off-by: José Simões <[email protected]>
1 parent 293563d commit c818c69

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

azure-pipelines.yml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ steps:
2525
git config --global user.name "nfbot"
2626
2727
echo "SourceBranchName $(Build.SourceBranchName)"
28+
echo "SourceBranch $(Build.SourceBranch)"
2829
echo "Reason $(Build.Reason)
2930
displayName: Setup git identity
3031

@@ -73,23 +74,23 @@ steps:
7374
inputs:
7475
versionSpec: '>= 2.4'
7576
addToPath: true
76-
condition: and( succeeded(), ne(variables['Build.Reason'], 'PullRequest') )
77+
condition: and( succeeded(), not( contains(variables['Build.SourceBranch'], 'pull') ) )
7778
displayName: Setup Ruby
7879

7980
# generate change log including future version
8081
- powershell: |
8182
gem install github_changelog_generator --quiet --no-ri --no-rdoc
8283
# need to call it passing both cache options with full path otherwise it won't work
8384
github_changelog_generator --token $(GitHubToken) --cache-log $env:AGENT_TEMPDIRECTORY\github-changelog-logger.log --cache-file $env:AGENT_TEMPDIRECTORY\github-changelog-http-cache
84-
condition: and( succeeded(), ne(variables['Build.Reason'], 'PullRequest'), not( contains(variables['Build.SourceBranchName'], 'tags') ), or( eq(variables['Build.SourceBranchName'], 'master'), contains(variables['Build.SourceBranchName'], 'release') ) )
85+
condition: and( succeeded(), not( contains(variables['Build.SourceBranch'], 'pull') ), not( contains(variables['Build.SourceBranch'], 'tags') ), or( eq(variables['Build.SourceBranchName'], 'master'), contains(variables['Build.SourceBranchName'], 'release') ) )
8586
displayName: Generate change log
8687

8788
# generate change log including future version
8889
- powershell: |
8990
gem install github_changelog_generator --quiet --no-ri --no-rdoc
9091
# need to call it passing both cache options with full path otherwise it won't work
9192
github_changelog_generator --token $(GitHubToken) --cache-log $env:AGENT_TEMPDIRECTORY\github-changelog-logger.log --cache-file $env:AGENT_TEMPDIRECTORY\github-changelog-http-cache --future-release v$env:MY_NUGET_VERSION
92-
condition: and( succeeded(), ne(variables['Build.Reason'], 'PullRequest'), not( contains(variables['Build.SourceBranchName'], 'tags') ), not( or( eq(variables['Build.SourceBranchName'], 'master'), contains(variables['Build.SourceBranchName'], 'release') ) ) )
93+
condition: and( succeeded(), not( contains(variables['Build.SourceBranch'], 'pull') ), not( contains(variables['Build.SourceBranch'], 'tags') ), not( or( eq(variables['Build.SourceBranchName'], 'master'), contains(variables['Build.SourceBranchName'], 'release') ) ) )
9394
displayName: Generate change log
9495

9596
# copy change log to artifacts directory
@@ -98,7 +99,7 @@ steps:
9899
SourceFolder: '$(System.DefaultWorkingDirectory)'
99100
Contents: 'CHANGELOG.md'
100101
TargetFolder: '$(Build.ArtifactStagingDirectory)'
101-
condition: and( succeeded(), ne(variables['Build.Reason'], 'PullRequest') )
102+
condition: and( succeeded(), not( contains(variables['Build.SourceBranch'], 'pull') ) )
102103
displayName: Copy Changelog
103104

104105
# push new changelog to GitHub repo
@@ -108,7 +109,7 @@ steps:
108109
# need to wrap the git command bellow so it doesn't throw an error because of redirecting the output to stderr
109110
git push origin "HEAD:$(Build.SourceBranchName)" --porcelain
110111
workingDirectory: $(System.DefaultWorkingDirectory)
111-
condition: and( succeeded(), ne(variables['Build.Reason'], 'PullRequest'), not( contains(variables['Build.SourceBranchName'], 'tags') ) )
112+
condition: and( succeeded(), not( contains(variables['Build.SourceBranch'], 'pull') ), not( contains(variables['Build.SourceBranch'], 'tags') ) )
112113
displayName: Push changelog to GitHub
113114

114115
# update could build number (only possible if this is not a PR from a fork)
@@ -168,7 +169,7 @@ steps:
168169
nuGetFeedType: external
169170
packagesToPush: '$(Build.ArtifactStagingDirectory)/$(nugetPackageName).nupkg;!$(Build.ArtifactStagingDirectory)/$(nugetPackageName).symbols.nupkg'
170171
publishFeedCredentials: 'NuGet'
171-
condition: and( succeeded(), ne(variables['Build.Reason'], 'PullRequest'), contains(variables['Build.SourceBranchName'], 'tags') )
172+
condition: and( succeeded(), not( contains(variables['Build.SourceBranch'], 'pull') ), contains(variables['Build.SourceBranch'], 'tags') )
172173
displayName: Push NuGet packages to NuGet
173174

174175
# step from template @ nf-tools repo

0 commit comments

Comments
 (0)