Skip to content

Commit f9d7e13

Browse files
committed
chore(CI): add automatic release
1 parent 577e221 commit f9d7e13

12 files changed

+82
-30
lines changed

.github/workflows/CI.yml

Lines changed: 70 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,44 @@
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
815

916
jobs:
1017
lint:
18+
name: ⬣ Lint
1119
runs-on: ubuntu-latest
1220
steps:
13-
- name: Checkout
21+
- name: 🛑 Cancel Previous Runs
22+
uses: styfle/[email protected]
23+
24+
- name: ⬇️ Checkout repo
1425
uses: actions/checkout@v3
1526

16-
- name: Install Node
27+
- name: ⎔ Setup Node
1728
uses: actions/setup-node@v3
1829
with:
1930
node-version: 18
2031

21-
- name: Install Packages
32+
- name: 📥 Install dependencies
2233
run: npm install
2334

24-
- name: Lint
35+
- name: ▶️ Run lint script
2536
run: npm run lint
2637

2738
test:
28-
name: Test (Node@${{ matrix.node }} - ESLint@${{ matrix.eslint }} - ${{ matrix.os }})
39+
name:
40+
🧪 Test (Node@${{ matrix.node }} - ESLint@${{ matrix.eslint }} - ${{
41+
matrix.os }})
2942
strategy:
3043
matrix:
3144
eslint: [6]
@@ -45,24 +58,65 @@ jobs:
4558
os: ubuntu-latest
4659
runs-on: ${{ matrix.os }}
4760
steps:
48-
- name: Checkout
61+
- name: 🛑 Cancel Previous Runs
62+
uses: styfle/[email protected]
63+
64+
- name: ⬇️ Checkout repo
4965
uses: actions/checkout@v3
5066

51-
- name: Install Node@${{ matrix.node }}
67+
- name: ⎔ Setup Node v${{ matrix.node }}
5268
uses: actions/setup-node@v3
5369
with:
5470
node-version: ${{ matrix.node }}
5571

56-
- name: Install Packages
72+
- name: 📥 Install dependencies
5773
run: npm install
5874

59-
# - name: Install ESLint@${{ matrix.eslint }}
60-
# run: npm install eslint@${{ matrix.eslint }}
75+
# - name: 📥 Install ESLint v${{ matrix.eslint }}
76+
# run: npm install --save-dev eslint@${{ matrix.eslint }}
6177

62-
- name: Test
78+
- name: ▶️ Run test script
6379
run: npm run test
6480

65-
# - name: Send Coverage
66-
# run: npm run -s codecov
67-
# env:
68-
# CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
81+
- name: ⬆️ Upload coverage report
82+
uses: codecov/codecov-action@v3
83+
84+
release:
85+
name: 🚀 Release
86+
needs: [lint, test]
87+
runs-on: ubuntu-latest
88+
if:
89+
github.repository == 'eslint-community/eslint-plugin-mysticatea' &&
90+
contains('refs/heads/main,refs/heads/next,refs/heads/beta,refs/heads/alpha',
91+
github.ref) && github.event_name == 'push'
92+
steps:
93+
- name: 🛑 Cancel Previous Runs
94+
uses: styfle/[email protected]
95+
96+
- name: ⬇️ Checkout repo
97+
uses: actions/checkout@v3
98+
99+
- name: ⎔ Setup node
100+
uses: actions/setup-node@v3
101+
with:
102+
node-version: 18
103+
104+
- name: 📥 Install dependencies
105+
run: npm install
106+
107+
- name: 🚀 Release
108+
uses: cycjimmy/semantic-release-action@v3
109+
with:
110+
semantic_version: 19
111+
branches: |
112+
[
113+
'+([0-9])?(.{+([0-9]),x}).x',
114+
'main',
115+
'next',
116+
'next-major',
117+
{name: 'beta', prerelease: true},
118+
{name: 'alpha', prerelease: true}
119+
]
120+
env:
121+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
122+
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/eslint-community/eslint-plugin-mysticatea/blob/v13.0.0/docs/rules/arrow-parens.md",
34+
"https://github.com/eslint-community/eslint-plugin-mysticatea/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/eslint-community/eslint-plugin-mysticatea/blob/v13.0.0/docs/rules/block-scoped-var.md",
200+
"https://github.com/eslint-community/eslint-plugin-mysticatea/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/eslint-community/eslint-plugin-mysticatea/blob/v13.0.0/docs/rules/no-instanceof-array.md",
18+
"https://github.com/eslint-community/eslint-plugin-mysticatea/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/eslint-community/eslint-plugin-mysticatea/blob/v13.0.0/docs/rules/no-instanceof-wrapper.md",
18+
"https://github.com/eslint-community/eslint-plugin-mysticatea/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/eslint-community/eslint-plugin-mysticatea/blob/v13.0.0/docs/rules/no-literal-call.md",
25+
"https://github.com/eslint-community/eslint-plugin-mysticatea/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/eslint-community/eslint-plugin-mysticatea/blob/v13.0.0/docs/rules/no-this-in-static.md",
18+
"https://github.com/eslint-community/eslint-plugin-mysticatea/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/eslint-community/eslint-plugin-mysticatea/blob/v13.0.0/docs/rules/no-use-ignored-vars.md",
24+
"https://github.com/eslint-community/eslint-plugin-mysticatea/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/eslint-community/eslint-plugin-mysticatea/blob/v13.0.0/docs/rules/no-useless-rest-spread.md",
101+
"https://github.com/eslint-community/eslint-plugin-mysticatea/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/eslint-community/eslint-plugin-mysticatea/blob/v13.0.0/docs/rules/prefer-for-of.md",
501+
"https://github.com/eslint-community/eslint-plugin-mysticatea/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": "@eslint-community/eslint-plugin-mysticatea",
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
"@eslint-community/eslint-plugin-mysticatea": "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)