2lach02/03/2024, 7:51 AM
I found a nifty solution (imo). Instead of attempting to commit a file with the latest Git SHA, I now generate it in a file called
<Target Name="PreBuild" BeforeTargets="PreBuildEvent">
<Exec Command="git rev-parse HEAD > $(ProjectDir)properties\commit.txt" />
during the build process. This way, I can easily parse and display the value. I've also added the file to
locally to prevent Git conflicts.
That the how
This worked smoothly on my local setup, but on Umbraco Cloud, it posed challenges.
As a Mac/Linux user, I'm not well-versed in Windows servers.
While exploring Kudu tools, I discovered that significant changes occur between pushing my code to Umbraco Cloud and its deployment, including alterations to the entire file structure. Despite performing a thorough PowerShell search on the server's hard drive, my "commit.txt" file was nowhere to be found.
Thats the WTF
So my question is
When creating a file on the fly containing the latest Git SHA value, where can I store it so it's reachable (on the win server) and there is a const/absolute path I can use to parse the value?
> It doesn't have to work locally but should always work from my Umbraco cloud server
That's the question
Thanks for reading any helpful advice is most welcome 👍
I know this can be solved with CI/CD pipelines and injecting the git sha as an env var, but honestly i don't want to rebuild the entire CD/CI process just to display a git sha.
Ambert02/03/2024, 12:09 PM
2lach02/03/2024, 5:28 PM
Ambert02/03/2024, 7:44 PM