git-for-windows / git-for-windows-automation

A few GitHub workflows and support code to help with Git for Windows' day-to-day tasks
10 stars 9 forks source link

create-self-hosted-runner: automatically use the latest Git for Windows and GitHub Actions runner version #16

Closed dscho closed 1 year ago

dscho commented 1 year ago

When spinning up the self-hosted Windows/ARM64 runners, we hard-code the Git for Windows version that gets installed, and likewise we hard-code the GitHub Actions runner version.

Let's determine the latest versions of both components automatically.

This requires a little bit of PowerShell scripting, accessing https://api.github.com/repos/git-for-windows/git/releases/latest and https://api.github.com/repos/actions/runner/releases/latest. Both the version string as well as the SHA-256 checksums need to be parsed out of the response.

dscho commented 1 year ago

This probably needs a combination of Invoke-WebRequest and ConvertFrom-JSON (similar to this code even if that calls into the Azure DevOps REST API, not the GitHub REST API, but the idea is the same).

hmartinez82 commented 1 year ago

I can't find a programmatic way of getting the checksum for the assets being downloaded. As per this discussion https://github.com/orgs/community/discussions/23512 it seems that it's a missing feature and it's up the the maintainers to list the asset checksums in the release notes. Any ideas?

rimrul commented 1 year ago

The checksums are listed in the release notes, so we should be able to parse them from there.

https://github.com/actions/runner/releases/latest

https://github.com/git-for-windows/git/releases/latest

hmartinez82 commented 1 year ago

Oh boy. Ok, I'll try that approach tomorrow. I didn't expect we were going there 😅 🤞🏼 they won't change the release notes format

rimrul commented 1 year ago

Certainly not ideal, but it's the best we've got

rstolpe commented 1 year ago

@dscho it do seem that @hmartinez82 has fixed this issue already, I was to slow. But if you have any other Powershell needs just DM me and I can look at it.

I can't see @hmartinez82 pull request but I guess that this one will close the issue :)

rstolpe commented 1 year ago

@dscho and @hmartinez82 I have a better solution for the Hash issue, hold on I'm looking in to it now.

hmartinez82 commented 1 year ago

@rstolpe You mean https://github.com/git-for-windows/git-for-windows-automation/pull/19 ? I'll close mine. You have a better solution with error handling and all

rstolpe commented 1 year ago

@rstolpe You mean https://github.com/git-for-windows/git-for-windows-automation/pull/19 ? I'll close mine. You have a better solution with error handling and all

I'll pull once more during next week with a better solution but the pr that I did now will work until I have the time to make it better :)

rstolpe commented 1 year ago

This issue will be closed with #19 pull req.