Skip to content

Commit

Permalink
Merge pull request #170 from Automattic/update/npm-publish-docs
Browse files Browse the repository at this point in the history
Updating CONTRIBUTING.md with new publishing procedure
  • Loading branch information
gudmdharalds committed Jul 31, 2023
2 parents 4bd1121 + df41c78 commit 864f812
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 0 deletions.
41 changes: 41 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,44 @@ This repo provides custom ESLint rules (in `./rules`) and configs (`./configs`).
## Automated Testing

This repo lints itself! Try to add code in `__fixtures__` that will produce errors, confirm that the errors are caught, then run `npm run jest:update-snapshot` to expect the errors.

## Publishing a New Release

The process to release to npm should be started when all pull requests intended for publishing have been merged and the software has been fully tested for publication. You can release either using GitHub Actions or locally.

### Versioning Guidelines

- `patch`: for non-breaking changes/bugfixes and small updates.
- `minor`: for some new features, bug fixes, and other non-breaking changes.
- `major`: for breaking changes.

### Note on NPM token

Publishing via the GitHub Action requires that the `NPM_TOKEN` be set correctly in GitHub Actions secrets. This should be an npm token generated for a bot user on [the npm @automattic org](https://www.npmjs.com/settings/automattic) that has publish access to this repo.

### How To Release

#### GitHub Actions (Preferred)

This is the preferred method for pushing out the latest release. The workflow runs a bunch of validations, generates a build, bump versions + tags, pushes out to npm, and bumps to the next dev version.

1. Initiate the [release process here](https://github.com/Automattic/eslint-config-wpvip/actions/workflows/npm-prepare-release.yml).
1. On the right-hand side, select "Run Workflow".
1. Pick your preferred version bump.
1. Click `Run Workflow`.
1. Wait for a pull request to appear. The pull request will update the version number and shall be assigned to you.
1. When ready, merge the pull request. This will lead to a new version to be [published on npmjs.com](https://www.npmjs.com/package/@automattic/eslint-plugin-wpvip).
1. Another pull request will be created to bump to a development version, also assigned to you. Merge it to finish the process.

#### Local

If GitHub Actions is down or not working for some reason or you need to push a release for a previous version (e.g. security release), you can still publish a new release.

1. Check out the branch or commit you want to release using `git`.
1. Run `npm run prepare` to generate the build.
1. Create a new branch for the release: `git checkout -b release/vX.Y.Z` -- remember to update the version number in the branch name.
1. Run`npm version <type>` to bump the version prior to publishing (see versioning types above).
1. Commit the changes and create a pull request, then merge it in GitHub.
1. Run`npm publish`.
1. Create [a new release in Github](https://github.com/Automattic/eslint-config-wpvip/releases/new). Use the built-in "Generate Release Notes" to get release notes. Tag the version.
1. Observe that the package has been released on GitHub and npmjs.com.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ Install `eslint` and `@automattic/eslint-plugin-wpvip` to your project.
npm install --save-dev eslint @automattic/eslint-plugin-wpvip
```

## Contributing

See [CONTRIBUTING.md](https://github.com/Automattic/eslint-config-wpvip/blob/trunk/CONTRIBUTING.md) for details on development, testing, publishing, etc.

## Configuration

Create an `.eslintrc.js` file. **Note:** The `init` file allows you to avoid installing peer dependencies (available from `v0.5.0`).
Expand Down

0 comments on commit 864f812

Please sign in to comment.