Skip to content

Commit c637584

Browse files
committed
feat: fix and update CI scripts (#24)
1 parent 4ef4abd commit c637584

File tree

6 files changed

+64
-25
lines changed

6 files changed

+64
-25
lines changed

.github/workflows/benchmark.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
name: Benchmarks
22

3-
on: [push, pull_request]
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
48

59
permissions:
610
contents: read
@@ -11,12 +15,12 @@ jobs:
1115
strategy:
1216
fail-fast: false
1317
matrix:
14-
node-version: [^18, ^20]
18+
node-version: [^20]
1519
steps:
16-
- uses: actions/checkout@v3
20+
- uses: actions/checkout@v4
1721

1822
- name: Set up Node.js
19-
uses: actions/setup-node@v3
23+
uses: actions/setup-node@v4
2024
with:
2125
node-version: ${{ matrix.node-version }}
2226

.github/workflows/ci.yml

Lines changed: 40 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
name: CI
22

3-
on: [push, pull_request]
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
48

59
permissions:
610
contents: read
@@ -9,10 +13,10 @@ jobs:
913
lint:
1014
runs-on: ubuntu-latest
1115
steps:
12-
- uses: actions/checkout@v3
16+
- uses: actions/checkout@v4
1317

1418
- name: Set up Node.js
15-
uses: actions/setup-node@v3
19+
uses: actions/setup-node@v4
1620
with:
1721
node-version: ^20
1822

@@ -29,10 +33,10 @@ jobs:
2933
contents: read
3034
pull-requests: write
3135
steps:
32-
- uses: actions/checkout@v3
36+
- uses: actions/checkout@v4
3337

3438
- name: Set up Node.js
35-
uses: actions/setup-node@v3
39+
uses: actions/setup-node@v4
3640
with:
3741
node-version: ^20
3842

@@ -43,7 +47,7 @@ jobs:
4347
run: yarn run coverage
4448

4549
- name: Coveralls
46-
uses: coverallsapp/github-action@master
50+
uses: coverallsapp/github-action@v2
4751
with:
4852
github-token: ${{ secrets.GITHUB_TOKEN }}
4953

@@ -54,10 +58,10 @@ jobs:
5458
matrix:
5559
node: [^20]
5660
steps:
57-
- uses: actions/checkout@v3
61+
- uses: actions/checkout@v4
5862

5963
- name: Set up Node.js
60-
uses: actions/setup-node@v3
64+
uses: actions/setup-node@v4
6165
with:
6266
node-version: ${{ matrix.node }}
6367

@@ -69,3 +73,31 @@ jobs:
6973

7074
- name: Run Build
7175
run: yarn run build
76+
77+
semantic-release:
78+
needs: [lint, test, coverage]
79+
runs-on: ubuntu-latest
80+
permissions:
81+
contents: write
82+
issues: write
83+
pull-requests: write
84+
steps:
85+
- uses: actions/checkout@v4
86+
with:
87+
fetch-depth: 0
88+
persist-credentials: false
89+
90+
- name: Set up Node.js
91+
uses: actions/setup-node@v4
92+
with:
93+
node-version: ^20
94+
95+
- name: Run semantic-release
96+
if: github.repository == 'casbin/casbin-core' && github.event_name == 'push' && github.ref == 'refs/heads/master'
97+
run: |
98+
yarn install
99+
yarn run build
100+
yarn run release
101+
env:
102+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
103+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

.github/workflows/platform_test.yml

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
name: Platform Test
22

3-
on: [push, pull_request]
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
48

59
permissions:
610
contents: read
@@ -13,10 +17,10 @@ jobs:
1317
matrix:
1418
node-version: [^20]
1519
steps:
16-
- uses: actions/checkout@v3
20+
- uses: actions/checkout@v4
1721

1822
- name: Set up Node.js
19-
uses: actions/setup-node@v3
23+
uses: actions/setup-node@v4
2024
with:
2125
node-version: ${{ matrix.node-version }}
2226

@@ -39,10 +43,10 @@ jobs:
3943
matrix:
4044
node-version: [^20]
4145
steps:
42-
- uses: actions/checkout@v3
46+
- uses: actions/checkout@v4
4347

4448
- name: Set up Node.js
45-
uses: actions/setup-node@v3
49+
uses: actions/setup-node@v4
4650
with:
4751
node-version: ${{ matrix.node-version }}
4852

@@ -62,10 +66,10 @@ jobs:
6266
matrix:
6367
node-version: [^20]
6468
steps:
65-
- uses: actions/checkout@v3
69+
- uses: actions/checkout@v4
6670

6771
- name: Set up Node.js
68-
uses: actions/setup-node@v3
72+
uses: actions/setup-node@v4
6973
with:
7074
node-version: ${{ matrix.node-version }}
7175

.releaserc.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"debug": true,
33
"branches": [
4-
"main",
4+
"master",
55
{
66
"name": "beta",
77
"channel": "beta",

README.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
# Casbin-Core
22

33
[![CI](https://github.com/casbin/casbin-core/actions/workflows/ci.yml/badge.svg)](https://github.com/casbin/casbin-core/actions/workflows/ci.yml)
4-
[![Coverage Status](https://coveralls.io/repos/github/casbin/casbin-core/badge.svg?branch=main)](https://coveralls.io/github/casbin/casbin-core?branch=main)
4+
[![Coverage Status](https://coveralls.io/repos/github/casbin/casbin-core/badge.svg?branch=master)](https://coveralls.io/github/casbin/casbin-core?branch=master)
55
[![NPM version][npm-image]][npm-url]
66
[![NPM download][download-image]][download-url]
7-
[![install size](https://packagephobia.now.sh/badge?p=casbin-core)](https://packagephobia.now.sh/result?p=casbin-core)
8-
[![codebeat badge](https://codebeat.co/badges/c17c9ee1-da42-4db3-8047-9574ad2b23b1)](https://codebeat.co/projects/github-com-casbin-casbin-core-main)
9-
[![Release](https://img.shields.io/github/release/casbin/casbin-core.svg)](https://github.com/casbin/casbin-core/releases/latest)
107
[![Discord](https://img.shields.io/discord/1022748306096537660?logo=discord&label=discord&color=5865F2)](https://discord.gg/S5UjpzGZjN)
118

129
[npm-image]: https://img.shields.io/npm/v/casbin-core.svg?style=flat-square

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"scripts": {
99
"prepack": "run-s lint test build",
1010
"postpack": "run-s clean",
11+
"prepublishOnly": "yarn run lint && yarn build",
1112
"build": "run-s clean && run-p build:**",
1213
"build:lib:cjs": "tsc -p tsconfig.cjs.json",
1314
"build:lib:esm": "tsc -p tsconfig.esm.json",
@@ -19,7 +20,8 @@
1920
"commit": "git-cz",
2021
"clean": "rimraf lib es dist",
2122
"coverage": "jest --coverage",
22-
"prepare": "husky install"
23+
"prepare": "husky install",
24+
"release": "npx -p semantic-release -p @semantic-release/git -p @semantic-release/changelog semantic-release"
2325
},
2426
"devDependencies": {
2527
"@commitlint/cli": "^16.3.0",

0 commit comments

Comments
 (0)