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

Use a local NuGet source for the release workflow tests #4084

Merged
merged 2 commits into from
Sep 18, 2024

Conversation

pepone
Copy link
Member

@pepone pepone commented Sep 18, 2024

This PR updates the release workflow to configure a local NuGet source for testing the packages and templates.

This PR fixes the issue of testing a new major release and using a range version for project templates and example projects.

With the previous setup if we set the range expression to "0.5.*", when we are running the release workflow for the new major version 0.5.0. The examples project and the new project templates would fail to build, because there is no published version that will match "0.5.*".

Adding a local source with the packages for the new version fixes the issue.

- "v[0-9]+.[0-9]+.[0-9]+-preview[0-9]+"
- "v[0-9]+.[0-9]+.[0-9]+.[0-9]+"
- "v[0-9]+.[0-9]+.[0-9]+.[0-9]+-preview[0-9]+"
- "v[0-9]*"
Copy link
Member Author

Choose a reason for hiding this comment

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

Simplified to use a single glob for all versions.

- name: Install NuGet packages and dotnet new templates
dotnet new nugetconfig -o ${{ github.workspace }}
dotnet nuget add source --configfile ${{ github.workspace }}/nuget.config -n "Local Packages" ${{ github.workspace }}/packages
shell: pwsh
Copy link
Member Author

Choose a reason for hiding this comment

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

This adds a new NuGet config file, and a source with the directory where we extracted the packages.

dotnet nuget push *.nupkg --source $env:USERPROFILE/.nuget/packages
dotnet new install IceRpc.Templates*.nupkg
if: runner.os == 'Windows'
shell: powershell
Copy link
Member Author

Choose a reason for hiding this comment

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

Don't need to push to local packages if we have a local source.

run: |
$version = $env:GITHUB_REF -replace '^refs/tags/v',''
echo "VERSION=$version" >> $env:GITHUB_ENV
if: runner.os == 'Windows'
Copy link
Member Author

Choose a reason for hiding this comment

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

Setting the version here was unnecessary.

for solution in examples/*/*/*.sln; do dotnet build "$solution"; done
if: runner.os == 'macOS' || runner.os == 'Linux'
shell: bash
dotnet new install IceRpc.Templates::$version
Copy link
Member Author

Choose a reason for hiding this comment

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

This install the project templates from the local source, we use ::$version to ensure we are testing the new version of the templates.

if: runner.os == 'macOS' || runner.os == 'Linux'
shell: bash
dotnet new install IceRpc.Templates::$version
shell: pwsh
- name: 🔨 Build Examples
run: |
$examples = Get-ChildItem -Path examples -Recurse -Include *.sln
foreach ($example in $examples) { dotnet build $example.FullName }
Copy link
Member Author

Choose a reason for hiding this comment

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

With the pwsh shell we can use the same command to build the examples in all platforms.

@@ -5,7 +5,7 @@
The version of the IceRPC NuGet packages used by the examples. It must be available from nuget.org once
this branch is released.
-->
<IceRpcVersion Condition="'$(IceRpcVersion)' == ''">0.4.0.1</IceRpcVersion>
<IceRpcVersion Condition="'$(IceRpcVersion)' == ''">0.5.0-preview1</IceRpcVersion>
Copy link
Member Author

Choose a reason for hiding this comment

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

Unrelated fix for the examples version.

@pepone pepone merged commit 718c607 into icerpc:main Sep 18, 2024
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants