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

Workflow Versions #771

Merged
merged 9 commits into from
Oct 20, 2024

Conversation

slxdy
Copy link
Contributor

@slxdy slxdy commented Oct 13, 2024

Featuring automatically-generated versions for workflows.
Each workflow run has its own version which is appended to the title as follows:
[major].[minor].[patch]-ci.[run number] | [Commit title]
For example:
0.6.6-ci.1971 | Cleanup

The version is also automatically passed to the compiler, which sets the versions of the built assemblies and the nuget package.
(Because assembly and file versions only support 4 numbers, the format is [major].[minor].[patch].[run number]).
To achieve this, I also wrote a new system for assembly metadata, which is stored in Directory.Build.props. I also removed the outdated assembly attributes.

The indev version (major, minor and patch) should be stored as a repository variable, named DEVVERSION. An example value is 0.6.6. You can find this setting in Repo > Settings > Secrets and variables > Actions > Variables > Repository variables.

I also changed BuildInfo.Version into a dynamic property that grabs the version from the assembly. This also allows mods to get the accurate version of MelonLoader at runtime and not just compile-time. (Changing the constant field into a property won't break backwards compatibility because constants are never directly referenced.)

To compile a non-prerelease build, you can build the project yourself. The version in Directory.Build.props will be applied.
You can also make a non-prerelease build by running the Build MelonLoader and Build NuGet Package manually (thus not through a push).

Let me know if I should change anything (and I apologize for the trash workflow code :( ).

@slxdy
Copy link
Contributor Author

slxdy commented Oct 13, 2024

To prevent confusion, the workflow run for the commit above failed because the DEVVERSION variable is empty for the this repo, which leads to an invalid version being passed to the compiler. To test, you can add the variable to the repo and manually rerun the checks.

@SamboyCoding
Copy link
Member

SamboyCoding commented Oct 13, 2024

Because assembly and file versions only support 4 numbers, the format is [major].[minor].[patch].[run number]

Not quite accurate, you can (and we arguably should in this case) have a version suffix, so you could do [major].[minor].[patch]-[branch name].[run number] e.g. 0.6.7-alpha-development.384

@slxdy slxdy marked this pull request as draft October 13, 2024 19:17
@slxdy
Copy link
Contributor Author

slxdy commented Oct 13, 2024

Marking as unready because of run number mismatch for the nuget workflow.

@SamboyCoding
Can we turn both workflows into one? Seems like an unnecessary split.

@slxdy
Copy link
Contributor Author

slxdy commented Oct 13, 2024

Because assembly and file versions only support 4 numbers, the format is [major].[minor].[patch].[run number]

Not quite accurate, you can (and we arguably should in this case) have a version suffix, so you could do [major].[minor].[patch]-[branch name].[run number] e.g. 0.6.7-alpha-development.384

CS7034 - The specified version string '0.6.7-alpha-development.384' does not conform to the required format - major[.minor[.build[.revision]]]

You can only use SemVersion for NuGet packages (which I'm already doing btw), but not for assembly version

@HerpDerpinstine
Copy link
Member

@SamboyCoding Can we turn both workflows into one? Seems like an unnecessary split.

If you want to see if you can integrate it into the main script I don't see the harm or an issue with that.
There are other repos that also do the same thing.

@slxdy
Copy link
Contributor Author

slxdy commented Oct 14, 2024

Actually, I already did that + optimized/simplified the workflow. I would just have to push the changes

@HerpDerpinstine HerpDerpinstine added Improvement New feature or request Work-in-Progress This issue or pull request is being worked on currently labels Oct 14, 2024
@slxdy
Copy link
Contributor Author

slxdy commented Oct 14, 2024

I suggest testing the Preload module changes. Can't test it for myself

@slxdy slxdy marked this pull request as ready for review October 14, 2024 12:09
@HerpDerpinstine HerpDerpinstine merged commit 3c26264 into LavaGang:alpha-development Oct 20, 2024
5 of 6 checks passed
@HerpDerpinstine HerpDerpinstine added Completed and removed Work-in-Progress This issue or pull request is being worked on currently labels Oct 20, 2024
@slxdy slxdy deleted the metadata-versioning branch October 20, 2024 22:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Completed Improvement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants