Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

automatically generate version suffixes #2709

Merged
merged 5 commits into from
Jan 9, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions azure-pipelines-release-nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,14 @@ pool:
demands:
- ImageOverride -equals MMS2022TLS

variables:

- name: PackageSuffix
${{ if ne(variables['Build.SourceBranchName'], 'dev') }}:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest checking $(Build.Reason) instead of source branch:

https://learn.microsoft.com/en-us/azure/devops/pipelines/build/variables?view=azure-devops&tabs=yaml

Can differentiate PR and CI this way.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll look into $(Build.Reason), good idea.
Though I just realized I made a mistake here - The nightly build should probably only build from dev anyways. So I should change to logic here so this is always a ci build.

value: 'ci.$(Build.BuildNumber)' # the "ci" section is to denote this payload is automatically released by the CI
${{ else }}:
value: ''

steps:

# Configure all the .NET SDK versions we need
Expand Down
11 changes: 11 additions & 0 deletions azure-pipelines-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,17 @@ pool:
demands:
- ImageOverride -equals MMS2022TLS

variables:

- name: PackageSuffix
# if source branch is not `dev` then we're generating a release based on a feature branch
# In that case, we populate the environment variable "PackageSuffix" accordingly
${{ if ne(variables['Build.SourceBranchName'], 'dev') }}:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here, can check Build.Reason.

Release build can be manual queue and dev branch.

And does this build def get ran post merge? In which case that would be a ci build.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Today, this pipeline only runs when manually triggered, so it does not run automatically post-merge. The nightly pipeline does run post-merge, but that's a different .yml.

In this case, since this pipeline is always manual - do you think still think it makes sense to check Build.Reason? In my mind, the Build.Reason for this pipeline is always: "Manual".

Copy link
Contributor

@jviau jviau Jan 8, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we you do the build reason calculation, that is a step towards getting rid of the separate nightly pipeline and using this one for that as well.

Also, this is used for PRs as well is it not? Build.Reason will show PR then.

value: 'pr.$(Build.BuildNumber)' # the "pr" section is to denote this code is a candidate to be PR'ed
${{ else }}:
value: ''


steps:

# Configure all the .NET SDK versions we need
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<MajorVersion>2</MajorVersion>
<MinorVersion>13</MinorVersion>
<PatchVersion>1</PatchVersion>
<Version>$(MajorVersion).$(MinorVersion).$(PatchVersion)</Version>
<VersionSuffix>$(PackageSuffix)</VersionSuffix>
<FileVersion>$(MajorVersion).$(MinorVersion).$(PatchVersion)</FileVersion>
<AssemblyVersion>$(MajorVersion).0.0.0</AssemblyVersion>
<Company>Microsoft Corporation</Company>
Expand All @@ -21,6 +21,14 @@
<NoWarn>NU5125;SA0001</NoWarn>
</PropertyGroup>

<PropertyGroup Condition="$(VersionSuffix) == ''">
<Version>$(MajorVersion).$(MinorVersion).$(PatchVersion)</Version>
</PropertyGroup>
<PropertyGroup Condition="$(VersionSuffix) != ''">
<Version>$(MajorVersion).$(MinorVersion).$(PatchVersion)-$(VersionSuffix)</Version>
</PropertyGroup>


<!-- NuGet Publishing Metadata -->
<PropertyGroup>
<Title>Azure Functions Durable Task Extension</Title>
Expand Down
Loading