Skip to content

Commit 72edba9

Browse files
committed
ci: enable automatic release via changesets (#123)
1 parent 0433a04 commit 72edba9

File tree

8 files changed

+628
-115
lines changed

8 files changed

+628
-115
lines changed

.changeset/README.md

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Changesets
2+
3+
Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
4+
with multi-package repos, or single-package repos to help you version and publish your code. You can
5+
find the full documentation for it [in our repository](https://github.com/changesets/changesets)
6+
7+
We have a quick list of common questions to get you started engaging with this project in
8+
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)

.changeset/config.json

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
3+
"changelog": "@changesets/changelog-github",
4+
"commit": false,
5+
"fixed": [],
6+
"linked": [],
7+
"access": "public",
8+
"baseBranch": "master",
9+
"updateInternalDependencies": "patch",
10+
"ignore": []
11+
}

.github/workflows/lint.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ jobs:
1212
runs-on: ubuntu-latest
1313

1414
steps:
15-
- uses: actions/checkout@v3
15+
- uses: actions/checkout@v4
1616
- name: Lint
17-
uses: actions/setup-node@v3
17+
uses: actions/setup-node@v4
1818
with:
1919
node-version: 14.x
20-
- run: npm install
21-
- run: npm run lint
20+
- run: yarn --frozen-lockfile
21+
- run: yarn lint

.github/workflows/release.yml

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
8+
concurrency:
9+
group: ${{ github.workflow }}-${{ github.ref }}
10+
cancel-in-progress: true
11+
12+
jobs:
13+
release:
14+
name: Release
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Checkout Repo
18+
uses: actions/checkout@v4
19+
with:
20+
# This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits
21+
fetch-depth: 0
22+
23+
- name: Setup Node.js LTS
24+
uses: actions/setup-node@v4
25+
with:
26+
node-version: lts/*
27+
cache: yarn
28+
29+
- name: Install Dependencies
30+
run: yarn --frozen-lockfile
31+
32+
- name: Create Release Pull Request or Publish to npm
33+
id: changesets
34+
uses: changesets/action@v1
35+
with:
36+
commit: 'chore: release simple-git-hooks'
37+
title: 'chore: release simple-git-hooks'
38+
publish: yarn release
39+
env:
40+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
41+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

.github/workflows/tests.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ jobs:
1212
runs-on: ubuntu-latest
1313

1414
steps:
15-
- uses: actions/checkout@v3
15+
- uses: actions/checkout@v4
1616
- name: Lint
17-
uses: actions/setup-node@v3
17+
uses: actions/setup-node@v4
1818
with:
1919
node-version: 14.x
20-
- run: npm install
21-
- run: npm run test
20+
- run: yarn --frozen-lockfile
21+
- run: yarn test
File renamed without changes.

package.json

+12-18
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,18 @@
55
"author": "Mikhail Gorbunov <[email protected]>",
66
"main": "simple-git-hooks.js",
77
"bin": "./cli.js",
8+
"packageManager": "[email protected]",
9+
"files": [
10+
"cli.js",
11+
"postinstall.js",
12+
"simple-git-hooks.js",
13+
"uninstall.js"
14+
],
815
"scripts": {
916
"postinstall": "node ./postinstall.js",
1017
"lint": "eslint *.js",
1118
"test": "jest",
12-
"publish": "publish",
13-
"create-publish-dist": "clean-publish --no-publish",
19+
"release": "clean-pkg-json && changeset publish",
1420
"uninstall": "node ./uninstall.js"
1521
},
1622
"keywords": [
@@ -29,29 +35,17 @@
2935
"lint-staged": {
3036
"*.js": "eslint"
3137
},
32-
"clean-publish": {
33-
"files": [
34-
"LICENSE.txt",
35-
".gitignore",
36-
"simple-git-hooks.test.js",
37-
"_tests",
38-
".github",
39-
".idea",
40-
".vscode",
41-
".npmignore",
42-
"changelog.md"
43-
],
44-
"packageManager": "npm"
45-
},
4638
"simple-git-hooks": {
4739
"pre-commit": "yarn lint"
4840
},
4941
"devDependencies": {
50-
"clean-publish": "^4.2.0",
42+
"@changesets/changelog-github": "^0.5.1",
43+
"@changesets/cli": "^2.28.1",
44+
"clean-pkg-json": "^1.2.1",
5145
"eslint": "^7.19.0",
5246
"jest": "^26.6.3",
5347
"lint-staged": "^10.5.4",
5448
"lodash.isequal": "^4.5.0",
55-
"simple-git-hooks": "^2.11.0"
49+
"simple-git-hooks": "link:."
5650
}
5751
}

0 commit comments

Comments
 (0)