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

ci: migrate semantic-release to changesets #443

Merged
merged 3 commits into from Aug 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 8 additions & 0 deletions .changeset/README.md
@@ -0,0 +1,8 @@
# Changesets

Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
with multi-package repos, or single-package repos to help you version and publish your code. You can
find the full documentation for it [in our repository](https://github.com/changesets/changesets)

We have a quick list of common questions to get you started engaging with this project in
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)
16 changes: 16 additions & 0 deletions .changeset/config.json
@@ -0,0 +1,16 @@
{
"$schema": "https://unpkg.com/@changesets/config/schema.json",
"changelog": [
"@changesets/changelog-github",
{
"repo": "prettier/prettier-eslint-cli"
}
],
"commit": false,
"fixed": [],
"linked": [],
"access": "public",
"baseBranch": "master",
"updateInternalDependencies": "patch",
"ignore": []
}
27 changes: 18 additions & 9 deletions .github/workflows/release.yml
Expand Up @@ -7,23 +7,32 @@ on:

jobs:
release:
name: Release
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Checkout Repo
uses: actions/checkout@v3
with:
# This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits
fetch-depth: 0

- uses: actions/setup-node@v3
- name: Setup Node.js LTS
uses: actions/setup-node@v3
with:
node-version: 16

- run: npm i
node-version: lts/*

- run: npm start build
- name: Install Dependencies
run: npm i

- name: Release
- name: Create Release Pull Request or Publish to npm
uses: changesets/action@v1
with:
# This expects you to have a script called release which does a build for your packages and calls changeset publish
publish: npm run release
# this expects you to have a npm script called version that runs some logic and then calls `changeset version`.
version: npm run version
commit: 'chore: release prettier-eslint-cli'
title: 'chore: release prettier-eslint-cli'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npx semantic-release
2 changes: 1 addition & 1 deletion .nvmrc
@@ -1 +1 @@
16.16.0
16.17.0
26 changes: 13 additions & 13 deletions CONTRIBUTING.md
Expand Up @@ -48,8 +48,8 @@ contribution type.

## Committing and Pushing changes

This project uses [`semantic-release`][semantic-release] to do automatic
releases and generate a changelog based on the commit history. So we follow
This project uses [`changesets`][changesets] to do automatic
releases and generate a changelog based on the changeset files. We follow
[a convention][convention] for commit messages. You don't have to follow this
convention if you don't like to. Just know that when we merge your commit, we'll
probably use "Squash and Merge" so we can change the commit message :)
Expand All @@ -58,17 +58,16 @@ Please make sure to run the tests before you commit your changes. You can run
`npm start test.update` which will update any snapshots that need updating.
Make sure to include those changes (if they exist) in your commit.

### opt into git hooks
You or a maintainer will need to add a changeset file on you pull request if we
want to draft a new release for your PR. If there are changeset files on the
master branch, [`changeset-bot`][changeset-bot] will raise a PR for releasing
automatically. When the release is finally ready, we will only need to merge
that PR.

There are git hooks set up with this project that are automatically installed
when you install dependencies. They're really handy, but are turned off by
default (so as to not hinder new contributors). You can opt into these by
creating a file called `.opt-in` at the root of the project and putting this
inside:
### simple-git-hooks

```
pre-commit
```
There are git hooks set up with this project that are automatically installed
when you install dependencies.

## Help needed

Expand All @@ -77,8 +76,9 @@ Please checkout the [the open issues][issues]
Also, please watch the repo and respond to questions/bug reports/feature requests! Thanks!

[egghead]: https://egghead.io/series/how-to-contribute-to-an-open-source-project-on-github
[semantic-release]: https://npmjs.com/package/semantic-release
[convention]: https://github.com/conventional-changelog/conventional-changelog-angular/blob/ed32559941719a130bb0327f886d6a32a8cbc2ba/convention.md
[changesets]: https://github.com/changesets/changesets
[changeset-bot]: https://github.com/apps/changeset-bot
[convention]: https://github.com/conventional-changelog/commitlint/tree/master/%40commitlint/config-conventional
[all-contributors]: https://github.com/kentcdodds/all-contributors
[issues]: https://github.com/prettier/prettier-eslint-cli/issues
[nps]: https://github.com/kentcdodds/nps
1 change: 1 addition & 0 deletions README.md
Expand Up @@ -7,6 +7,7 @@ CLI for [`prettier-eslint`][prettier-eslint]
[![version][version-badge]][package]
[![downloads][downloads-badge]][npm-stat]
[![MIT License][license-badge]][license]
[![changesets](https://img.shields.io/badge/maintained%20with-changesets-176de3.svg?style=flat-square)](https://github.com/atlassian/changesets)

[![Open Collective backers and sponsors](https://img.shields.io/opencollective/all/prettier?style=flat-square)](https://opencollective.com/prettier)
[![All Contributors](https://img.shields.io/badge/all_contributors-21-orange.svg?style=flat-square)](#contributors)
Expand Down
13 changes: 9 additions & 4 deletions package.json
@@ -1,6 +1,6 @@
{
"name": "prettier-eslint-cli",
"version": "0.0.0-development",
"version": "7.0.1",
"description": "CLI for prettier-eslint",
"main": "dist/no-main.js",
"engines": {
Expand All @@ -13,6 +13,10 @@
"build": "nps build",
"lint": "nps lint",
"prepare": "patch-package && simple-git-hooks",
"prerelease": "nps build",
"release": "clean-pkg-json && changeset release",
JounQin marked this conversation as resolved.
Show resolved Hide resolved
"version": "changeset version",
"postversion": "npm start test.update",
"start": "nps",
"test": "nps test"
},
Expand Down Expand Up @@ -59,18 +63,19 @@
"@babel/core": "^7.18.10",
"@babel/node": "^7.18.10",
"@babel/preset-env": "^7.18.10",
"@changesets/changelog-github": "^0.4.6",
"@changesets/cli": "^2.24.3",
"all-contributors-cli": "^6.20.0",
"clean-pkg-json": "^1.0.1",
"eslint-config-kentcdodds": "^20.3.1",
"eslint-plugin-node-dependencies": "^0.8.0",
"jest": "^28.1.3",
"lint-staged": "^12.5.0",
"nps": "^5.10.0",
"nps-utils": "^1.7.0",
"opt-cli": "^1.6.0",
"patch-package": "^6.4.7",
"pify": "^5.0.0",
"rimraf": "^3.0.2",
"semantic-release": "^17.4.7",
"simple-git-hooks": "^2.8.0",
"spawn-command": "0.0.2-1",
"strip-indent": "^3.0.0",
Expand All @@ -84,7 +89,7 @@
"singleQuote": true
},
"simple-git-hooks": {
"pre-commit": "npx lint-staged && npx opt --in pre-commit --exec \"npm start validate\""
"pre-commit": "npx lint-staged && npm start validate"
},
"repository": {
"type": "git",
Expand Down
2 changes: 1 addition & 1 deletion test/tests/__snapshots__/cli.spec.js.snap
@@ -1,7 +1,7 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`prettier-eslint --version: stdout: --version 1`] = `
"0.0.0-development
"7.0.1
"
`;

Expand Down