nodejs / import-in-the-middle

Like `require-in-the-middle`, but for ESM import
https://www.npmjs.com/package/import-in-the-middle
Apache License 2.0
52 stars 20 forks source link

chore: Add release workflow #123

Closed timfish closed 4 days ago

timfish commented 4 days ago

Ref #122

release-please.yml is copied straight from here: https://github.com/nodejs/node-addon-api/blob/main/.github/workflows/release-please.yml

For this to actually work it needs Github credentials that can create PRs that trigger other workflows. The default GITHUB_TOKEN cannot do this. https://github.com/googleapis/release-please-action?tab=readme-ov-file#github-credentials

We also need an NPM token added to the secrets so it can publish.

jsumners-nr commented 4 days ago

The tool supports changing the log type to use the GitHub API - https://github.com/googleapis/release-please/blob/main/docs/customizing.md#changelog-types

timfish commented 4 days ago

The tool supports changing the log type to use the GitHub API

Ah nice. Do you know where this setting goes? It's not immediately obvious!

EDIT Found it. Their number of options were getting out of hand so now there's a manifest file!

timfish commented 4 days ago

Who do we need to ping to get the correct tokens added to the repo secrets? If we do that before this is merged it should create a release PR!

anonrig commented 4 days ago

Who do we need to ping to get the correct tokens added to the repo secrets? If we do that before this is merged it should create a release PR!

@bengl @mhdawson can you add the repo secret to land this?

mhdawson commented 4 days ago

@legendecas any chance you could help with adding the token since you did it recently for the node-addon-api repo and can probably do it faster than me?

legendecas commented 4 days ago

any chance you could help with adding the token since you did it recently for the node-addon-api repo and can probably do it faster than me?

done. Added NPM_TOKEN repository secret granular token, expiring on July 31, 2025.

timfish commented 4 days ago

Perfect, I think we just need a Github token now unless that has been added too?

legendecas commented 4 days ago

GITHUB_TOKEN is automatically generated: https://docs.github.com/en/actions/security-guides/automatic-token-authentication.

I think this should be ready.

timfish commented 4 days ago

GITHUB_TOKEN is automatically generated

It is automatically generated, but if PRs are created with that token, workflows don't run on them.

The release-please docs cover this and I've seen this issue on other repositories.

By default, Release Please uses the built-in GITHUB_TOKEN secret. However, all resources created by release-please (release tag or release pull request) will not trigger future GitHub actions workflows, and workflows normally triggered by release.created events will also not run.

You will want to configure a GitHub Actions secret with a Personal Access Token if you want GitHub Actions CI checks to run on Release Please PRs.

Githubs own docs also mention this:

When you use the repository's GITHUB_TOKEN to perform tasks, events triggered by the GITHUB_TOKEN will not create a new workflow run. This prevents you from accidentally creating recursive workflow runs.

Although now I'm looking at other PRs created by release-please in other Node org repos, workflows aren't running in those so maybe there's no need for workflows to run in the release PRs?

I'll merge this and it can be added later if it's a problem!

timfish commented 4 days ago

So the PR has been created but the workflow hasn't run so there's no way to merge it!