fsolauncher icon indicating copy to clipboard operation
fsolauncher copied to clipboard

[Feature] Automate Remesh Package zip timestamp

Open ItsSim opened this issue 1 year ago • 2 comments

Is your feature request related to a problem? Please describe. The remesh package needs the last modification timestamp in its file name in releases (e.g.: remeshes-1.0.0-1717947681.zip) for the launcher to check that it's been updated.

It currently requires editing the timestamp.txt https://github.com/ItsSim/fsolauncher/blob/develop/extras/fsolauncher-remeshes/timestamp.txt with the desired timestamp. Then GitHub Actions reads this file and creates the remesh .zip with the timestamp in the filename.

I tried changing the GitHub CI .yml to automatically add the timestamp of the last commit made to the remeshes folder in https://github.com/ItsSim/fsolauncher/tree/develop/extras/fsolauncher-remeshes/remeshes, but it didn't work because it seemed to always return the current date (so the remesh package would always have a new timestamp). Lost the code for this so I can't post it here for reference.

Describe the solution you'd like A way to automatically set the last modification timestamp to the remesh .zip file. Should ideally be whenever the remeshes folder was last updated.

Describe alternatives you've considered Alternative would be to just leave it as is, but would be a nice enhancement to figure this out.

Additional context Add any other context or screenshots about the feature request here.

ItsSim avatar Jul 27 '24 17:07 ItsSim

Been a while since I have done anything in GitHub Actions. Can you write a script to fetch https://api.github.com/repos/itssim/fsolauncher/commits?path=extras%2Ffsolauncher-remeshes&page=1&per_page=1 - using cURL? object.commit.committer.date is the last commit date, then just a case of converting that to unix time?

tomgrice avatar Aug 26 '24 03:08 tomgrice

Been a while since I have done anything in GitHub Actions. Can you write a script to fetch api.github.com/repos/itssim/fsolauncher/commits?path=extras/fsolauncher-remeshes&page=1&per_page=1 - using cURL? object.commit.committer.date is the last commit date, then just a case of converting that to unix time?

That seems like it would work, didn't know about this part of the GitHub API.

Since the GitHub Action runs the build.js in fsolauncher-remeshes https://github.com/ItsSim/fsolauncher/blob/develop/extras/fsolauncher-remeshes/build.js and currently just reads from timestamp.txt, would be a matter of just changing that to read from that API, perhaps using the API token in the request, that can be exposed as a node.js environment variable when running in the GitHub Action https://github.com/ItsSim/fsolauncher/blob/4675b1ecbdef29c452bde848ddcfe48b51afe101/.github/workflows/electron_ci.yml#L137

ItsSim avatar Aug 26 '24 03:08 ItsSim