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

build: automate winget package creation #34014

Closed
wants to merge 1 commit into from

Conversation

bzoz
Copy link
Contributor

@bzoz bzoz commented Jun 22, 2020

Add GitHub action that will automatically create a PR adding new Node installers to the winget-pckg repository.

The action is triggered when a new GitHub release is made. At this point, the new installer should already be published. The script will:

The action requires some outside setup. A machine user needs to be created and have a fork of the microsft/winget-pckg repository. The machine user PAT, email, etc. need to be added as repository secrets.

One thing we might want to customize more is the license and description fields. For now I went with:

License: Copyright Node.js contributors. All rights reserved.
LicenseUrl: https://raw.githubusercontent.com/nodejs/node/master/LICENSE
...
Description: Node.js® is a JavaScript runtime built on Chrome's V8 JavaScript engine.

Ref: nodejs/Release#587

Checklist

Add GitHub action that will automatically create a PR adding new Node
installers to the winget-pckg repository.
@nodejs-github-bot nodejs-github-bot added the meta Issues and PRs related to the general management of the project. label Jun 22, 2020
@bzoz
Copy link
Contributor Author

bzoz commented Jun 22, 2020

/cc @nodejs/releasers @nodejs/build

@richardlau
Copy link
Member

The action requires some outside setup. A machine user needs to be created and have a fork of the microsft/winget-pckg repository. The machine user PAT, email, etc. need to be added as repository secrets.

Neither the Build WG nor releasers have authority to create repository secrets for this repository -- that would fall under @nodejs/tsc.

@Trott
Copy link
Member

Trott commented Jun 23, 2020

The action requires some outside setup. A machine user needs to be created and have a fork of the microsft/winget-pckg repository. The machine user PAT, email, etc. need to be added as repository secrets.

Neither the Build WG nor releasers have authority to create repository secrets for this repository -- that would fall under @nodejs/tsc.

Perhaps @mhdawson?

@mmarchini
Copy link
Contributor

I opened a request on nodejs/admin, once the request is approved as per our policy I can help setup the secrets in this repository.

@mmarchini
Copy link
Contributor

@bzoz the request to add secrets to the repo was approved, feel free to ping me once this is ready to land to help setup secrets in the repo.

@nodejs/build this need reviewers.

Comment on lines +12 to +14
on:
release:
types: [published]
Copy link
Contributor

Choose a reason for hiding this comment

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

Just a quick note on expectations: I'm pretty sure this will only land if the published tag includes this file, which means once it lands we should backport it to every active major.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This file only needs to be in master, it will work for all published tags. The script also works if it is called from other repos (like this PR made from this release in my fork)

Copy link
Contributor

@mmarchini mmarchini Aug 20, 2020

Choose a reason for hiding this comment

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

Interesting, that's quite inconsistent with how other Actions events work, but if it works it works :)

(just a note, on the release in your fork the file exists in the release, so that's not a valid test to see if it works with the file only on master)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You've got a point there, I'll check it out. I've written the script some time ago, might as well check if it still works.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm checking on a personal repository, will share the results soon

Copy link
Contributor

Choose a reason for hiding this comment

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

It only runs if the action exists in the release, I pushed a simple action that runs on publish, then I published 0.0.2 from master, which triggered the run, and then I published 0.0.1 from the commit right before the action was added, which didn't trigger the run.

Actions have weird semantics sometimes.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Huh, good to know. Thanks for investigating this.

Copy link
Contributor

Choose a reason for hiding this comment

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

No problem. Also, this doesn't block or affect this PR, it's just a heads up of what we need to do once we land it.

@bzoz
Copy link
Contributor Author

bzoz commented Aug 20, 2020

Verified, the script still works. It creates PRs: microsoft/winget-pkgs#3157 and stops if package with the given version is already there: https://github.com/bzoz/node/runs/1007269352?check_suite_focus=true

@aduh95
Copy link
Contributor

aduh95 commented Nov 8, 2020

Is this ready to land?

@PoojaDurgad PoojaDurgad added the build Issues and PRs related to build files or the CI. label Dec 24, 2020
@PoojaDurgad
Copy link
Contributor

I would like to ping @nodejs/build to review.

@Trott Trott added the request-ci Add this label to start a Jenkins CI on a PR. label Dec 28, 2020
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Dec 28, 2020
@nodejs-github-bot
Copy link
Collaborator

@mmarchini
Copy link
Contributor

@bzoz what's your preferred channel to share the secrets so I can add it to the repo?

@bzoz
Copy link
Contributor Author

bzoz commented Jan 5, 2021

@mmarchini shouldn't the build team create that machine account?

@mmarchini
Copy link
Contributor

When you say a "machine account", do you mean a GitHub bot account like @nodejs-github-bot? Reading the description I assumed it was a Microsoft publisher account on Azure or smth (no idea if that even exists, I'm not familiar with Windows ecosystem).

@bzoz
Copy link
Contributor Author

bzoz commented Jan 5, 2021

Yeah, sorry I didn't make that more clear. A GitHub user with a fork of the winget packages repo is needed.

@mmarchini
Copy link
Contributor

Ok, we'll just use the @nodejs-github-bot then. I assume it's fine for the fork to live on the nodejs/ org with the bot having write access to it, right? From experience with a similar setup on nodejs/docker-node, keeping the fork on a bot account makes permission management quite complicated.

@bzoz
Copy link
Contributor Author

bzoz commented Jan 5, 2021

The script assumes that the repo is forked by the user (here, here and here). Those lines would have to be changed.

@mmarchini
Copy link
Contributor

humm, ok, let's create the fork on @nodejs-github-bot for now and if it becomes a pain to manage we can move it to the foundation and make the necessary changes to the Action.

Copy link
Contributor

This issue/PR was marked as stalled, it will be automatically closed in 30 days. If it should remain open, please leave a comment explaining why it should remain open.

Copy link
Contributor

Closing this because it has stalled. Feel free to reopen if this issue/PR is still relevant, or to ping the collaborator who labelled it stalled if you have any questions.

@github-actions github-actions bot closed this Jun 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build Issues and PRs related to build files or the CI. meta Issues and PRs related to the general management of the project. stalled Issues and PRs that are stalled.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants