-
Notifications
You must be signed in to change notification settings - Fork 259
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
Create WinGet workflow #673
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤔 It would probably be ideal if this could be combined with the CD
workflow. Then you can set that this job needs deploy
, which seems necessary as it looks like this action relies on assets already being published. Probably better than just retrying every 10 minutes up to the 5th try. It's also ideal for this job to simply not run if the deploy
job fails.
You can ignore my note on uses: vedantmgoyal20009/...
. I'm not requesting a change there, just making a note.
It could be made into a docker action to allow it to run on ubuntu/macos, but then it wouldn't be able to run on windows 😆 🙃 |
I actually made an issue about a similar issue I had: #442, asking for it to be allowed to be ran on other workflow events. However, they said they ran into an issue with this:
|
Huh, just took a quick look, but it seems like this could honestly be automated with |
With the Edit: See this as an example. Of course, different workflow (on tag pushed instead of on release), but I hope it's a decent example of delaying one job until the other finishes. |
I didn't consider this. Thank you :)
I imagine this reason that this hasn't be done already is because wingetcreate isn't as verbose in its options as the script is maybe? For example, being able to delete a previous version. Meanwhile, I could tag always vedantmgoyal2009 for visibility on this? I imagine they'd be happy to help |
No problem, I'm not opposed 🙂 |
Sorry for the late reply. onefetch/.github/workflows/cd.yml Lines 1 to 4 in ac338c8
You'll have to change the event type to released otherwise pull requests will be created for draft and pre-releases too. |
AFAIK there wouldn't be any problem changing the action trigger type to |
TBH, I've just discovered - thanks to @vedantmgoyal2009 comment - the distinction between the |
@russellbanks I created the token: |
Brill, just make sure you've added that token to this repository :) |
done: I'll let @spenserblack finish his review and approve the PR, did you settle on this? |
Thanks for the changes, @o2sh! With this, we should be able to add this as a job to the CD workflow, so that it only triggers after a release is created. Something vaguely like this jobs:
deploy:
# ...
winget-pkg-release:
needs: [ deploy ]
runs-on: windows-latest
# etc. BTW, a |
Oh, also I just thought about this: git remote add winget https://github.com/microsoft/winget-pkgs.git
git fetch winget
git branch winget-pkg winget/master
git checkout winget-pkg
# make changes
git push -u origin winget-pkg
# make PR from <repo>:winget-pkg to microsoft/winget-pkgs:master It's not blocking this PR, but just something to think about as a way to make your action more friendly to users 🙂 Edit: nevermind, I forgot that making a PR to another repo requires elevated permissions 😞 |
@russellbanks I think we can now go with #673 (comment). jobs:
deploy:
# ...
winget-pkg-release:
needs: [ deploy ]
runs-on: windows-latest
# etc. |
I've made those changes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
This pull request adds a workflow that automatically publishes Onefetch to WinGet every release, as discussed in vedantmgoyal9/vedantmgoyal9#638. Please do not merge this pull request without reading the below and making the required changes (The token part is the important bit) :)
runs-on: windows-latest
The WinGet Releaser action can only run on Windows.
identifier: o2sh.onefetch
This is the identifier for Onefetch on Winget. It will use this to find Onefetch's current package on WinGet.
installers-regex: '\.exe$'
This will make all
.exe
files in the assets of the latest Onefetch release to be included in the pull request.delete-previous-version: 'true'
This is optional, and you are welcome to change this to false (or omit it; the default is false). This will essentially overwrite the previous version on WinGet packages, so that only this new version is stored on WinGet. Again, entirely optional.
token: ${{ secrets.WINGET_TOKEN }}
This is the bit that will require action from yourself. This is a GitHub token with which the action will authenticate with GitHub and create a pull request on the winget-pkgs repository.
To do this, you will need to:
Create a Personal Access Token (PAT) with
public_repo
scope on your GitHub account.Create a repository secret containing the token. Super important: call this token:
WINGET_TOKEN
.See using encrypted secrets in a workflow for more details.
Finally, make sure you have a fork of winget-pkgs on your GitHub account. Please do not delete the fork after a pull request has been merged as the action will use that fork for making a branch and merging it with the upstream winget-pkgs repository on every Onefetch release.
The above is made on the assumption that the account that the token is from (and the fork is present) is @o2sh. If you would like this to be done by another account, the token would have to be from the different user and an extra line would have to be added:
fork-user: # Username of other user
(this defaults to the repository owner, which is why it doesn't have to be added)If you would like to read about this action further, the documentation is here and the source code is here.
If you are interested in what a pull request made by this action looks like, here is one from my account: #61982 on winget-pkgs.
If you are concerned about the generated executable (#668) not getting included in the action when it checks the assets, it actually has a retry logic that will retry for up to an hour, checking every ten minutes for the required asset in the created release. If it's still not in the assets at that point, it will fail and you can re-run it at a later date when it is.Merged with CD workflow so this will always run after the assets have been built.