@@ -2,26 +2,35 @@ name: CI
2
2
3
3
on :
4
4
pull_request :
5
+ types : [opened, synchronize]
5
6
paths-ignore : ["**.md"]
6
7
push :
7
- branches : [" main", " next" ]
8
+ branches : [main, next]
8
9
paths-ignore : ["**.md"]
9
10
10
11
jobs :
11
- lint :
12
+ format :
12
13
runs-on : ubuntu-latest
13
14
steps :
14
15
- name : Checkout code
15
- uses : actions/checkout@v2
16
+ uses : actions/checkout@v3
16
17
- name : Use node
17
18
uses : actions/setup-node@v2
18
19
with :
19
20
node-version : 16.x
20
- cache : " npm"
21
+ cache : npm
21
22
- name : Install dependencies
22
23
run : npm ci
23
- - name : Lint code
24
- run : npm run lint
24
+ - name : Format Code
25
+ run : npm run format
26
+ - name : Commit changes
27
+ uses : stefanzweifel/git-auto-commit-action@v4
28
+ with :
29
+ commit_message : " [ci] format"
30
+ commit_user_name : " github-actions[bot]"
31
+ commit_user_email : " github-actions[bot]@users.noreply.github.com"
32
+ env :
33
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
25
34
test :
26
35
runs-on : ${{ matrix.os }}
27
36
strategy :
@@ -31,12 +40,12 @@ jobs:
31
40
node : [14.x, 16.x]
32
41
steps :
33
42
- name : Checkout code
34
- uses : actions/checkout@v2
43
+ uses : actions/checkout@v3
35
44
- name : Use node@${{ matrix.node }}
36
45
uses : actions/setup-node@v2
37
46
with :
38
47
node-version : ${{ matrix.node }}
39
- cache : " npm"
48
+ cache : npm
40
49
- name : Install dependencies
41
50
run : npm ci
42
51
- name : Run tests
@@ -45,22 +54,27 @@ jobs:
45
54
uses : codecov/codecov-action@v2
46
55
release :
47
56
runs-on : ubuntu-latest
48
- needs : [lint, test]
57
+ needs : [format, test]
58
+ if : ${{ github.repository == 'marko-js/htmljs-parser' && github.event_name == 'push' }}
49
59
steps :
50
- - name : Check releasable
51
- if : ${{ github.repository == 'marko-js/htmljs-parser' && github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/next') }}
52
- run : exit 0
53
60
- name : Checkout code
54
- uses : actions/checkout@v2
61
+ uses : actions/checkout@v3
55
62
- name : Setup node
56
63
uses : actions/setup-node@v2
57
64
with :
58
65
node-version : 16.x
59
- cache : " npm"
66
+ cache : npm
60
67
- name : Install dependencies
61
68
run : npm ci
62
69
- name : Release
63
- run : npm run release
70
+ id : changesets
71
+ uses : changesets/action@v1
72
+ with :
73
+ createGithubReleases : true
74
+ version : npm run version
75
+ publish : npm run publish
76
+ commit : " [ci] release"
77
+ title : " [ci] release"
64
78
env :
65
79
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
66
80
NPM_TOKEN : ${{ secrets.NPM_TOKEN }}
0 commit comments