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

chore: add release script #3891

Merged
merged 25 commits into from
Feb 13, 2022
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
12f7954
chore: fix `next-auth` version in `package.json`
balazsorban44 Feb 9, 2022
0a933f6
chore: add WIP publish script
balazsorban44 Feb 9, 2022
8f7f803
chore: fix comments, add TODOs
balazsorban44 Feb 9, 2022
9efb042
chore: set newer TS target
balazsorban44 Feb 10, 2022
604bdc3
chore: extract release config
balazsorban44 Feb 10, 2022
b7bdd28
chore: WIP work on publish script
balazsorban44 Feb 10, 2022
fb42d4c
chore: finish up release script
balazsorban44 Feb 11, 2022
ff4b17d
Merge branch 'main' into chore/release-script
balazsorban44 Feb 11, 2022
531cad4
chore: do not push unless not dryRun
balazsorban44 Feb 11, 2022
b417b0d
chore: add debug env var, return early if no package to update
balazsorban44 Feb 11, 2022
64a614e
chore: remove unnecessary comment
balazsorban44 Feb 11, 2022
43fdbb3
chore: remove changeset and unused dependencies
balazsorban44 Feb 11, 2022
aa82a1d
chore: drop `semantic-release`
balazsorban44 Feb 11, 2022
00c3611
chore: remove `jsonfile` dependency
balazsorban44 Feb 11, 2022
235c9be
chore: address code review
balazsorban44 Feb 11, 2022
ec11d26
fix: list other commits in changelog when releasing
balazsorban44 Feb 11, 2022
657ded6
Merge branch 'main' into chore/release-script
balazsorban44 Feb 13, 2022
1be9244
chore: fix env variable references
balazsorban44 Feb 13, 2022
a129f8e
chore: fetch with tags and commit history
balazsorban44 Feb 13, 2022
3df21fd
chore: fix analyze code
balazsorban44 Feb 13, 2022
a4c810b
chore: fix utils script
balazsorban44 Feb 13, 2022
97d91fc
chore: better changelog formatting
balazsorban44 Feb 13, 2022
6683246
chore: fix package path
balazsorban44 Feb 13, 2022
dd78553
chore: fix some remaining stuff
balazsorban44 Feb 13, 2022
fb51340
chore: remove DEBUG flag
balazsorban44 Feb 13, 2022
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: 0 additions & 8 deletions .changeset/README.md

This file was deleted.

10 changes: 0 additions & 10 deletions .changeset/config.json

This file was deleted.

21 changes: 11 additions & 10 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ jobs:
uses: actions/setup-node@v2
with:
node-version: 16
cache: 'yarn'
- name: Install dependencies
cache: "yarn"
- name: Install dependencies
run: yarn --frozen-lockfile
- name: Build
run: npm run build
Expand All @@ -48,16 +48,17 @@ jobs:
uses: actions/setup-node@v2
with:
node-version: 16
cache: 'yarn'
- name: Install dependencies
cache: "yarn"
- name: Install dependencies
run: yarn --frozen-lockfile
- name: Publish to npm and GitHub
run: |
cd packages/next-auth
npx semantic-release@17
run: yarn release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
NPM_TOKEN_PKG: ${{ secrets.NPM_TOKEN }}
NPM_TOKEN_ORG: ${{ secrets.NPM_TOKEN_ORG }}
DRY_RUN: true
DEBUG: true
release-pr:
name: Publish PR
runs-on: ubuntu-latest
Expand All @@ -71,8 +72,8 @@ jobs:
uses: actions/setup-node@v2
with:
node-version: 16
cache: 'yarn'
- name: Install dependencies
cache: "yarn"
- name: Install dependencies
run: yarn --frozen-lockfile
- name: Determine version
uses: ./.github/version-pr
Expand Down
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# CHANGELOG

The changelog is automatically updated using
[semantic-release](https://github.com/semantic-release/semantic-release). You
[scripts/release/index.ts](https://github.com/nextauthjs/next-auth/tree/main/scripts/index.ts). You
can see it on the [releases page](../../releases).
32 changes: 8 additions & 24 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,43 +85,27 @@ You can look at the existing built-in providers for inspiration.
#### Databases

If you would like to contribute to an existing database adapter or help create a new one, head over to the [nextauthjs/adapters](https://www.github.com/nextauthjs/adapters) repository and follow the instructions provided there.

#### Testing

Tests can be run with `yarn test`.

Automated tests are currently crude and limited in functionality, but improvements are in development.

## For maintainers

We use [semantic-release](https://github.com/semantic-release/semantic-release) together with [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0) to automate releases. This makes the maintenance process easier and less error-prone to human error. Please study the "Conventional Commits" site to understand how to write a good commit message.
We use [a custom script](https://github.com/nextauthjs/next-auth/tree/main/scripts/index.ts) together with [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0) to automate releases. This makes the maintenance process easier and less error-prone. Please study the "Conventional Commits" site to understand how to write a good commit message.

When accepting Pull Requests, make sure the following:

- Use "Squash and merge"
- Make sure you merge contributor PRs into `main`
- Rewrite the commit message to conform to the `Conventional Commits` style. Check the "Recommended Scopes" section for further advice.
- Rewrite the commit message to conform to the `Conventional Commits` style.
- Using `fix` releases a patch (x.x.1)
- Using `feat` releases a minor (x.1.x)
- Using `feat` when `BREAKING CHANGE` is present in the commit messgae releases a major (1.x.x)
- Optionally link issues the PR will resolve (You can add "close" in front of the issue numbers to close the issues automatically, when the PR is merged. `semantic-release` will also comment back to connected issues and PRs, notifying the users that a feature is added/bug fixed, etc.)

### Recommended Scopes

A typical conventional commit looks like this:

```
type(scope): title

body
```

Scope is the part that will help grouping the different commit types in the release notes.

Some recommended scopes are:

- **provider** - Provider related changes. (eg.: "feat(provider): add X provider", "docs(provider): fix typo in X documentation"
- **adapter** - Adapter related changes. (eg.: "feat(adapter): add X provider", "docs(provider): fix typo in X documentation"
- **db** - Database related changes. (eg.: "feat(db): add X database", "docs(db): fix typo in X documentation"
- **deps** - Adding/removing/updating a dependency (eg.: "chore(deps): add X")

> NOTE: If you are not sure which scope to use, you can simply ignore it. (eg.: "feat: add something"). Adding the correct type already helps a lot when analyzing the commit messages.

### Skipping a release

Every commit that contains [skip release] or [release skip] in their message will be excluded from the commit analysis and won't participate in the release type determination. This is useful, if the PR being merged should not trigger a new `npm` release.
If a commit contains `[skip release]` in their message will be excluded from the commit analysis and won't participate in the release type determination. This is useful, if the PR being merged should not trigger a new `npm` release.
41 changes: 32 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@
"version": "0.0.0",
"private": true,
"workspaces": {
"packages": ["packages/*", "apps/dev", "docs"]
"packages": [
"packages/*",
"apps/dev",
"docs"
]
},
"repository": "https://github.com/nextauthjs/next-auth.git",
"scripts": {
Expand All @@ -15,24 +19,30 @@
"dev": "yarn dev:app",
"dev:app": "turbo run dev --parallel --no-deps --no-cache --scope=next-auth-app",
"dev:docs": "turbo run dev --parallel --no-deps --no-cache --scope=next-auth-docs",
"version:pr": "node ./config/version-pr"
"version:pr": "node ./config/version-pr",
"release": "ts-node scripts/release"
},
"devDependencies": {
"@actions/core": "^1.6.0",
"@changesets/cli": "^2.20.0",
"@commitlint/parse": "16.0.0",
"@types/semver": "7.3.9",
"@typescript-eslint/eslint-plugin": "^5.10.2",
"@typescript-eslint/parser": "^4.33.0",
"conventional-changelog-conventionalcommits": "4.6.1",
"eslint": "^7.32.0",
"eslint-config-prettier": "^8.3.0",
"eslint-config-standard-with-typescript": "^21.0.1",
"eslint-plugin-import": "^2.25.4",
"eslint-plugin-jest": "^25.3.0",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^6.0.0",
"git-log-parser": "1.2.0",
"husky": "^7.0.4",
"jsonfile": "6.1.0",
"prettier": "2.4.1",
"pretty-quick": "^3.1.2",
"semver": "7.3.5",
"stream-to-array": "2.3.0",
"ts-node": "10.5.0",
"turbo": "^1.1.2",
"typescript": "^4.5.2"
},
Expand All @@ -44,7 +54,10 @@
},
"eslintConfig": {
"parser": "@typescript-eslint/parser",
"extends": ["standard-with-typescript", "prettier"],
"extends": [
"standard-with-typescript",
"prettier"
],
"ignorePatterns": [
"node_modules",
"next-env.d.ts",
Expand All @@ -68,16 +81,26 @@
},
"overrides": [
{
"files": ["./**/*test.js"],
"files": [
"./**/*test.js"
],
"env": {
"jest/globals": true
},
"extends": ["plugin:jest/recommended"],
"plugins": ["jest"]
"extends": [
"plugin:jest/recommended"
],
"plugins": [
"jest"
]
}
]
},
"eslintIgnore": ["./*.d.ts", "**/tests", "**/__tests__"],
"eslintIgnore": [
"./*.d.ts",
"**/tests",
"**/__tests__"
],
"packageManager": "yarn@1.22.17",
"funding": [
{
Expand Down
31 changes: 2 additions & 29 deletions packages/next-auth/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "next-auth",
"version": "4.1.2",
"version": "4.2.1",
"description": "Authentication for Next.js",
"homepage": "https://next-auth.js.org",
"repository": "https://github.com/nextauthjs/next-auth.git",
Expand Down Expand Up @@ -86,7 +86,6 @@
}
},
"devDependencies": {
"@actions/core": "^1.6.0",
"@babel/cli": "^7.16.0",
"@babel/core": "^7.16.0",
"@babel/plugin-proposal-optional-catch-binding": "^7.16.0",
Expand Down Expand Up @@ -133,31 +132,5 @@
"./*.d.ts",
"**/tests",
"**/__tests__"
],
"release": {
"branches": [
"+([0-9])?(.{+([0-9]),x}).x",
"main",
{
"name": "beta",
"prerelease": true
},
{
"name": "next",
"prerelease": true
}
],
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
"@semantic-release/npm",
[
"@semantic-release/github",
{
"releasedLabels": false,
"successComment": false
}
]
]
}
]
}