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

Add C# project support #36

Merged
merged 6 commits into from
Oct 7, 2024
Merged

Conversation

supermomonga
Copy link
Contributor

This Pull Request adds support for C# projects (.csproj files).

.csproj files may contain not only the Version attribute but also the VersionPrefix and VersionSuffix. These Version, VersionPrefix, and VersionSuffix tags are interdependent, and when dealing with prerelease versions (e.g., v0.0.1-beta.1), all of these attributes must be considered. However, as my understand, bump-request action is currently not concerned with prerelease versions. so this Pull Request only handles the Version attribute.

ref:

@r7kamura
Copy link
Owner

r7kamura commented Oct 5, 2024

I have no idea about csproj, but I am positive about supporting it 👍

@r7kamura
Copy link
Owner

r7kamura commented Oct 5, 2024

I'm not sure if this code will really work. Sorry to take your time., but can you provide some sort of sample project where we can verify that this works correctly?

@r7kamura
Copy link
Owner

r7kamura commented Oct 5, 2024

In the case of gem, we need to update the Gemfile.lock when we change the version (by running bundle install),
but in the case of csproj, is there no need to add such a process? Is it that there is no culture to include such files that define dependencies to Git?

function changeGemVersion(version: string) {
replaceContent(
fs.expandGlobSync("lib/**/version.rb").next().value.path,
/VERSION = (['"]).*?\1/,
`VERSION = '${version}'`,
);
exec.exec("bundle", ["install"]);
}


(btw, this is totally unrelated to this pull request, but for some reason this gem support is not working properly at the moment, and I'm still investigating the cause...)

@supermomonga
Copy link
Contributor Author

supermomonga commented Oct 5, 2024

I'm not sure if this code will really work. Sorry to take your time., but can you provide some sort of sample project where we can verify that this works correctly?

Yeah, of course! I'll create a sample repository.

In the case of gem, we need to update the Gemfile.lock when we change the version (by running bundle install),
but in the case of csproj, is there no need to add such a process? Is it that there is no culture to include such files that define dependencies to Git?

There is opt-in lockfile. When we define RestorePackagesWithLockFile as true in csproj file, packages.lock.json file will be generated, and used by dotnet restore command (equally to Ruby's bundle install command)

ref: https://learn.microsoft.com/ja-jp/azure/devops/pipelines/artifacts/caching-nuget?view=azure-devops

I added restore command at f3e4ba6 cd7f2c5.

@supermomonga
Copy link
Contributor Author

@r7kamura I created a sample repository. Could you check it?

https://github.com/supermomonga/bump-request_CSharpDemo

I created a demo branch and apply temporally change to action.yml for demo use, and sample repository use this.

PRs created by bump-reqeust workflow

@r7kamura
Copy link
Owner

r7kamura commented Oct 5, 2024

Looks generally good.

In the case of gem, we need to update the Gemfile.lock when we change the version (by running bundle install),
but in the case of csproj, is there no need to add such a process?

I made the above comment because I thought it was supposed to include its own version in packages.lock.json, like Gemfile.lock, so I thought we needed to run some command to update the embedded version. But in fact, that is not how packages.lock.json works, is it? If so, there may be no benefit to running dotnet restore here at all. What do you think about this?

@supermomonga
Copy link
Contributor Author

Ah, I got your point now.

I made the the above comment because I thought it was supposed to include its own version in packages.lock.json, like Gemfile.lock, so I thought we needed to run some command to update the embedded version. But in fact, that is not how packages.lock.json works, is it? If so, there may be no benefit to running dotnet restore here at all. What do you think about this?

Yes, you right.

Just to be sure, I also checked the specifications for NuGet Package (equivalent to a gem in Ruby), but it seems that the version of the library itself is not used.

I removed dotnet restore command.

@r7kamura r7kamura merged commit 7b7a15c into r7kamura:main Oct 7, 2024
1 check passed
@r7kamura r7kamura added the add Add new features. label Oct 7, 2024
@github-actions github-actions bot mentioned this pull request Oct 7, 2024
@supermomonga supermomonga deleted the csproj-support branch October 7, 2024 08:53
@r7kamura
Copy link
Owner

r7kamura commented Oct 7, 2024

Just released v0.5.0, thank you!

@supermomonga
Copy link
Contributor Author

@r7kamura Thanks ✨

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
add Add new features.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants