Skip to content

Commit 29fc823

Browse files
committed
chore(CI): add automatic release
1 parent 23f619e commit 29fc823

12 files changed

+73
-29
lines changed

.github/workflows/CI.yml

Lines changed: 61 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
11
name: CI
22
on:
33
push:
4-
branches: [main]
4+
branches:
5+
# default semantic-release branches
6+
- "+([0-9])?(.{+([0-9]),x}).x"
7+
- "main"
8+
- "next"
9+
- "next-major"
10+
- "beta"
11+
- "alpha"
512
pull_request:
613
schedule:
714
- cron: 0 0 * * 0
@@ -10,18 +17,21 @@ jobs:
1017
lint:
1118
runs-on: ubuntu-latest
1219
steps:
13-
- name: Checkout
20+
- name: 🛑 Cancel Previous Runs
21+
uses: styfle/[email protected]
22+
23+
- name: ⬇️ Checkout repo
1424
uses: actions/checkout@v3
1525

16-
- name: Install Node
26+
- name: ⎔ Setup Node
1727
uses: actions/setup-node@v3
1828
with:
1929
node-version: 18
2030

21-
- name: Install Packages
31+
- name: 📥 Install dependencies
2232
run: npm install
2333

24-
- name: Lint
34+
- name: ▶️ Run lint script
2535
run: npm run lint
2636

2737
test:
@@ -45,24 +55,60 @@ jobs:
4555
os: ubuntu-latest
4656
runs-on: ${{ matrix.os }}
4757
steps:
48-
- name: Checkout
58+
- name: 🛑 Cancel Previous Runs
59+
uses: styfle/[email protected]
60+
61+
- name: ⬇️ Checkout repo
4962
uses: actions/checkout@v3
5063

51-
- name: Install Node@${{ matrix.node }}
64+
- name: ⎔ Setup Node
5265
uses: actions/setup-node@v3
5366
with:
5467
node-version: ${{ matrix.node }}
5568

56-
- name: Install Packages
69+
- name: 📥 Install dependencies
5770
run: npm install
5871

59-
# - name: Install ESLint@${{ matrix.eslint }}
60-
# run: npm install eslint@${{ matrix.eslint }}
72+
# - name: 📥 Install ESLint
73+
# run: npm install eslint@${{ matrix.eslint }}
6174

62-
- name: Test
75+
- name: ▶️ Run test script
6376
run: npm run test
6477

65-
# - name: Send Coverage
66-
# run: npm run -s codecov
67-
# env:
68-
# CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
78+
- name: ⬆️ Upload coverage report
79+
uses: codecov/codecov-action@v3
80+
81+
release:
82+
needs: [lint, test]
83+
runs-on: ubuntu-latest
84+
if: github.repository == 'eslint-community/mysticatea__eslint-plugin' &&
85+
contains('refs/heads/main,refs/heads/next,refs/heads/beta,refs/heads/alpha',
86+
github.ref) && github.event_name == 'push'
87+
steps:
88+
- name: 🛑 Cancel Previous Runs
89+
uses: styfle/[email protected]
90+
91+
- name: ⬇️ Checkout repo
92+
uses: actions/checkout@v3
93+
94+
- name: ⎔ Setup node
95+
uses: actions/setup-node@v3
96+
with:
97+
node-version: 18
98+
99+
- name: 🚀 Release
100+
uses: cycjimmy/semantic-release-action@v3
101+
with:
102+
semantic_version: 19
103+
branches: |
104+
[
105+
'+([0-9])?(.{+([0-9]),x}).x',
106+
'main',
107+
'next',
108+
'next-major',
109+
{name: 'beta', prerelease: true},
110+
{name: 'alpha', prerelease: true}
111+
]
112+
env:
113+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
114+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

lib/rules/arrow-parens.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ module.exports = {
3131
category: "Stylistic Issues",
3232
recommended: false,
3333
url:
34-
"https://github.com/mysticatea/eslint-plugin/blob/v13.0.0/docs/rules/arrow-parens.md",
34+
"https://github.com/mysticatea/eslint-plugin/blob/HEAD/docs/rules/arrow-parens.md",
3535
},
3636
fixable: "code",
3737
schema: [],

lib/rules/block-scoped-var.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ module.exports = {
197197
category: "Possible Errors",
198198
recommended: false,
199199
url:
200-
"https://github.com/mysticatea/eslint-plugin/blob/v13.0.0/docs/rules/block-scoped-var.md",
200+
"https://github.com/mysticatea/eslint-plugin/blob/HEAD/docs/rules/block-scoped-var.md",
201201
},
202202
fixable: null,
203203
schema: [],

lib/rules/no-instanceof-array.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ module.exports = {
1515
description: "disallow 'instanceof' for Array",
1616
category: "Best Practices",
1717
url:
18-
"https://github.com/mysticatea/eslint-plugin/blob/v13.0.0/docs/rules/no-instanceof-array.md",
18+
"https://github.com/mysticatea/eslint-plugin/blob/HEAD/docs/rules/no-instanceof-array.md",
1919
},
2020
fixable: "code",
2121
schema: [],

lib/rules/no-instanceof-wrapper.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ module.exports = {
1515
description: "disallow 'instanceof' for wrapper objects",
1616
category: "Best Practices",
1717
url:
18-
"https://github.com/mysticatea/eslint-plugin/blob/v13.0.0/docs/rules/no-instanceof-wrapper.md",
18+
"https://github.com/mysticatea/eslint-plugin/blob/HEAD/docs/rules/no-instanceof-wrapper.md",
1919
},
2020
fixable: "code",
2121
schema: [],

lib/rules/no-literal-call.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ module.exports = {
2222
category: "Possible Errors",
2323
recommended: false,
2424
url:
25-
"https://github.com/mysticatea/eslint-plugin/blob/v13.0.0/docs/rules/no-literal-call.md",
25+
"https://github.com/mysticatea/eslint-plugin/blob/HEAD/docs/rules/no-literal-call.md",
2626
},
2727
fixable: null,
2828
schema: [],

lib/rules/no-this-in-static.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ module.exports = {
1515
description: "Disallow `this`/`super` in static methods",
1616
category: "Best Practices",
1717
url:
18-
"https://github.com/mysticatea/eslint-plugin/blob/v13.0.0/docs/rules/no-this-in-static.md",
18+
"https://github.com/mysticatea/eslint-plugin/blob/HEAD/docs/rules/no-this-in-static.md",
1919
},
2020
fixable: null,
2121
schema: [],

lib/rules/no-use-ignored-vars.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ module.exports = {
2121
category: "Stylistic Issues",
2222
recommended: false,
2323
url:
24-
"https://github.com/mysticatea/eslint-plugin/blob/v13.0.0/docs/rules/no-use-ignored-vars.md",
24+
"https://github.com/mysticatea/eslint-plugin/blob/HEAD/docs/rules/no-use-ignored-vars.md",
2525
},
2626
fixable: null,
2727
schema: [{ type: "string" }],

lib/rules/no-useless-rest-spread.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ module.exports = {
9898
category: "Best Practices",
9999
recommended: false,
100100
url:
101-
"https://github.com/mysticatea/eslint-plugin/blob/v13.0.0/docs/rules/no-useless-rest-spread.md",
101+
"https://github.com/mysticatea/eslint-plugin/blob/HEAD/docs/rules/no-useless-rest-spread.md",
102102
},
103103
fixable: "code",
104104
schema: [],

lib/rules/prefer-for-of.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -498,7 +498,7 @@ module.exports = {
498498
category: "Best Practices",
499499
recommended: false,
500500
url:
501-
"https://github.com/mysticatea/eslint-plugin/blob/v13.0.0/docs/rules/prefer-for-of.md",
501+
"https://github.com/mysticatea/eslint-plugin/blob/HEAD/docs/rules/prefer-for-of.md",
502502
},
503503
fixable: "code",
504504
schema: [],

lib/utils.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,15 @@ module.exports = {
3838
return configuredRulesDocumentUrl
3939
}
4040
try {
41-
const { version, repository } = JSON.parse(
41+
const { repository } = JSON.parse(
4242
fs.readFileSync(
4343
path.join(process.cwd(), "package.json"),
4444
"utf8"
4545
)
4646
)
4747
const baseUrl = getBaseUrl(repository)
4848
if (baseUrl) {
49-
return `${baseUrl}/blob/v${version}/docs/rules/{{name}}.md`
49+
return `${baseUrl}/blob/HEAD/docs/rules/{{name}}.md`
5050
}
5151
} catch (_error) {
5252
// ignore

package.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@mysticatea/eslint-plugin",
3-
"version": "13.0.0",
3+
"version": "0.0.0-semantically-released",
44
"description": "Additional ESLint rules.",
55
"engines": {
66
"node": ">=8.10.0"
@@ -25,7 +25,6 @@
2525
},
2626
"devDependencies": {
2727
"@mysticatea/eslint-plugin": "file:.",
28-
"codecov": "^3.6.1",
2928
"eslint": "~6.6.0",
3029
"fs-extra": "^8.1.0",
3130
"globals": "^12.1.1",
@@ -39,7 +38,6 @@
3938
"scripts": {
4039
"clean": "rimraf .nyc_output coverage",
4140
"coverage": "opener coverage/lcov-report/index.html",
42-
"codecov": "codecov --disable=gcov -t $CODECOV_TOKEN",
4341
"lint": "eslint lib scripts tests",
4442
"test": "nyc mocha \"tests/lib/**/*.js\" --reporter dot",
4543
"update": "node scripts/generate-browser-globals && node scripts/generate-configs && node scripts/generate-rules",

0 commit comments

Comments
 (0)