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 tests and automated publishing the package to NPM #89

Closed
wants to merge 7 commits into from

Conversation

robmosca
Copy link
Contributor

@robmosca robmosca commented Jul 19, 2023

I created this PR on top of #87

In the additional commit, I introduced automated publishing of the package. It uses the changesets/action action. And works in the following way:

  1. As a contributor, when I open a PR I always have to remember to add the corresponding changeset (by using pnpm changeset)
  2. The PR itself will run a job to build, lint and test the code. The maintainers of this repository can add this job as a required job to be able to merge the PR. In this way, if a PR does not pass any of the steps (build, check-format, lint, test) it won't be possible to merge it
  3. When the PR is merged to the main branch, the changesets/action will find that there is a changeset file, and will open a PR to publish the package. This PR is the result of running pnpm changeset version on the code in the main branch.
  4. If other PRs are merged from other contributors, the changesets files will accumulate and the PR opened at step 3 will be updated including all contributions
  5. Once the maintainers are ready to release the package, they just have to merge the release PR. This time, the changesets/action, seeing that there is no changeset file anymore, will publish the package to NPM and create a release with the corresponding release notes in GitHub

For this to work it is necessary that:

  1. The GITHUB_TOKEN is granted permissions to create and approve pull requests. This can be done in Settings -> Actions -> General -> Workflow permissions -> Allow GitHub Actions to create and approve pull requests
  2. The maintainers create an NPM_TOKEN secret with an NPM token with write permissions to the organization (or at least the corresponding package, for publishing).

@robmosca robmosca force-pushed the add-publish-automation branch from ad0eb59 to 791a077 Compare July 19, 2023 22:08
@robmosca robmosca changed the title Add tests and automated publishing the package to NPM [Proposal] Add tests and automated publishing the package to NPM Jul 20, 2023
@robmosca robmosca force-pushed the add-publish-automation branch 2 times, most recently from 515f2d2 to 5c754e6 Compare July 21, 2023 14:42
@robmosca robmosca force-pushed the add-publish-automation branch from 5c754e6 to 4c1c6df Compare July 24, 2023 15:20
This was referenced Sep 10, 2023
@robmosca
Copy link
Contributor Author

These changes are included in #94.
If you prefer reviewing the most comprehensive PR we can close this one.

@robmosca robmosca changed the title [Proposal] Add tests and automated publishing the package to NPM Add tests and automated publishing the package to NPM Sep 11, 2023
@changeset-bot
Copy link

changeset-bot bot commented Sep 29, 2023

🦋 Changeset detected

Latest commit: 09057fe

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
import-map-overrides Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@robmosca
Copy link
Contributor Author

Closed in favour of #96

@robmosca robmosca closed this Sep 29, 2023
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.

1 participant