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 GitHub Action to Update the Windows installer to Winget #500

Merged
merged 7 commits into from
Jan 21, 2024

Conversation

MrHinsh
Copy link
Contributor

@MrHinsh MrHinsh commented Dec 20, 2023

This should only be merged once microsoft/winget-pkgs#131370 has been approved and it will update this package based on each GitHub Release.

@MrHinsh
Copy link
Contributor Author

MrHinsh commented Dec 20, 2023

Blocked due to #499

@MrHinsh MrHinsh mentioned this pull request Dec 27, 2023
@MrHinsh
Copy link
Contributor Author

MrHinsh commented Jan 8, 2024

This is now open on microsoft/winget-pkgs#131370 but has a "no-executable" block. I have commented and hopefully we can get it past the reviewer.

@MrHinsh MrHinsh marked this pull request as ready for review January 9, 2024 08:51
@MrHinsh
Copy link
Contributor Author

MrHinsh commented Jan 9, 2024

All approved!

image

One can now install this tool using "winget install RoyShilkrot.obs-backgroundremoval"...

This PR adds an Action that triggers whenever there is a release and updates winget with the latest version.

Copy link
Collaborator

@royshil royshil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can certainly add this
and thank you very much for the contribution

i have a couple questions

iwr https://aka.ms/wingetcreate/latest -OutFile wingetcreate.exe
$github = Get-Content '${{ github.event_path }}' | ConvertFrom-Json
$installerUrl = $github.release.assets | Where-Object -Property name -match 'obs-backgroundremoval-*-windows-x64-Installer.exe' | Select -ExpandProperty browser_download_url -First 1
.\wingetcreate.exe update RoyShilkrot.obs-backgroundremoval -s -v $github.release.tag_name -u $installerUrl -t ${{ secrets.UPDATETHIS_PAT }}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this secrets.UPDATETHIS_PAT needed somewhere?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I can change it to the same that you want, but it should be a build variable with a PAT token that has "public_repo" permission

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you explain the PAT token? is this something that Winget expects? i would need to sign up somewhere to get it?

i can add it as a repo secret

Copy link
Contributor Author

@MrHinsh MrHinsh Jan 10, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Its a GitHub PAT token. Winget-Create creates a Pull Request on Github for the submission.

https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens

Yes, you would create a classic PAT and add it as a secret on the repo. Then update the "secret."

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@royshil do you have a variable name for your secret that I can use?

Copy link
Collaborator

@royshil royshil Jan 10, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i don't have a PAT yet
what sort of permissions does the PAT need though? i'd like to avoid the less secured "classic" PATs
i can create one and add it as a secret

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It only needs "public_repo"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.github/actions/winget-update/action.yaml Outdated Show resolved Hide resolved
.github/actions/winget-update/action.yaml Outdated Show resolved Hide resolved
Co-authored-by: Kaito Udagawa <umireon@gmail.com>
Copy link
Member

@umireon umireon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you fix this file path? I don't think your file will work because this is placed under the wrong path.

@MrHinsh
Copy link
Contributor Author

MrHinsh commented Jan 10, 2024

@umireon, what path would you like the file under? I used the same format as your existing actions.

@umireon
Copy link
Member

umireon commented Jan 10, 2024

The .github/actions directory is for hosting custom actions. What you wrote is not a custom action but a workflow. Any workflow files must be stored under the .github/workflows directory.

@MrHinsh
Copy link
Contributor Author

MrHinsh commented Jan 10, 2024

@umireon DONE

.github/workflows/winget-update.yaml Outdated Show resolved Hide resolved
.github/workflows/winget-update.yaml Outdated Show resolved Hide resolved
@umireon
Copy link
Member

umireon commented Jan 11, 2024

@MrHinsh Who should be the owner of the PAT that this workflow requires? Our organization (occ-ai) or a personal account (@royshil 's one)?

@umireon
Copy link
Member

umireon commented Jan 11, 2024

I don't think that the organization PAT can create PR.

@MrHinsh
Copy link
Contributor Author

MrHinsh commented Jan 11, 2024

I use a non-expiring personal token.

@umireon
Copy link
Member

umireon commented Jan 18, 2024

@royshil ping

royshil and others added 3 commits January 18, 2024 15:49
Co-authored-by: Kaito Udagawa <umireon@gmail.com>
Co-authored-by: Kaito Udagawa <umireon@gmail.com>
@royshil
Copy link
Collaborator

royshil commented Jan 18, 2024

i cretaed a PAT and added it as a secret
had to change the name since secrets cannot start with GITHUB_

@royshil
Copy link
Collaborator

royshil commented Jan 18, 2024

how do we test if this works without having to publish a release?

@MrHinsh
Copy link
Contributor Author

MrHinsh commented Jan 18, 2024

You can't.

You could add an additional release type to allow manual triggering of it, but it would not have the release context.

@royshil
Copy link
Collaborator

royshil commented Jan 19, 2024

ok well this is all set on the repo secrets side
so i suppose we can merge and see if it works in the next version release

@royshil royshil self-requested a review January 19, 2024 15:32
Copy link
Collaborator

@royshil royshil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i'm ok with landing this

Copy link
Member

@umireon umireon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@umireon umireon merged commit 9a1566c into locaal-ai:main Jan 21, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants