Skip to content

Commit

Permalink
Support branch conventions to skip packaging (#13)
Browse files Browse the repository at this point in the history
Co-authored-by: Wim Vergouwe <[email protected]>
  • Loading branch information
WimVergouwe and Wim Vergouwe authored Jan 14, 2022
1 parent 5ebb3e1 commit fd7d99d
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions azure/pipelines/dotnet/ci.branch.conventions.vars.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ parameters:
type: boolean
default: false
displayName: 'Skip tests.'
- name: withPack
type: boolean
default: true
displayName: 'Whether to create packages to publish to feeds.'
- name: withPublish
type: boolean
default: false
Expand All @@ -16,28 +20,28 @@ parameters:
variables:
${{ if and( parameters.Prerelease, ne(parameters.Prerelease, 'none') ) }}:
# Detected prerelease build due to parameter.
withPack: true
withPack: ${{ eq(parameters.withPack, true) }}
withPublish: ${{ eq(parameters.withPublish, true) }}
withRelease: true
prerelease: ${{ parameters.prerelease }}
noTests: ${{ parameters.noTests }}
${{ if and( or( not(parameters.Prerelease), eq(parameters.Prerelease, 'none') ), startsWith(variables['Build.SourceBranch'], 'refs/heads/prereleases/') ) }}:
# Detected prerelease build for prerelease branch.
withPack: true
withPack: ${{ eq(parameters.withPack, true) }}
withPublish: ${{ eq(parameters.withPublish, true) }}
withRelease: true
prerelease: ${{ variables['Build.SourceBranchName'] }}
# Don't test to improve build times when prereleasing, tests should have succeeded during PR.
noTests: true
${{ if and( or( not(parameters.Prerelease), eq(parameters.Prerelease, 'none') ), or( eq(variables['Build.SourceBranch'], 'refs/heads/main'), eq(variables['Build.SourceBranch'], 'refs/heads/master'), startsWith(variables['Build.SourceBranch'], 'refs/heads/releases/') ) ) }}:
# Detected release build for main, master or release branch.
withPack: true
withPack: ${{ eq(parameters.withPack, true) }}
withPublish: ${{ eq(parameters.withPublish, true) }}
withRelease: true
# Don't test to improve build times when releasing, tests should have succeeded during PR.
noTests: true
${{ if and( eq(parameters.Prerelease, 'none'), ne(variables['Build.SourceBranch'], 'refs/heads/main'), ne(variables['Build.SourceBranch'], 'refs/heads/master'), not( startsWith(variables['Build.SourceBranch'], 'refs/heads/releases/') ), not( startsWith(variables['Build.SourceBranch'], 'refs/heads/prereleases/') ) ) }}:
withPack: false
withPublish: false
withRelease: true
withRelease: false
noTests: ${{ parameters.noTests }}

0 comments on commit fd7d99d

Please sign in to comment.