Skip to content

Commit 5de70ec

Browse files
committed
ci: add pipelines and automate releases
1 parent 9e5b2af commit 5de70ec

3 files changed

Lines changed: 131 additions & 0 deletions

File tree

.github/workflows/run_ci.yml

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
name: NodeJS
2+
3+
on:
4+
push:
5+
branches: ["main"]
6+
pull_request:
7+
branches: ["main"]
8+
schedule:
9+
- cron: "30 0 * * *"
10+
11+
env:
12+
SECRET_DETECTION_JSON_REPORT_FILE: "gitleaks.json"
13+
14+
jobs:
15+
eslint:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v4
20+
- name: Install dependencies
21+
run: npm ci
22+
- name: Run eslint check
23+
run: npm run lint
24+
25+
format:
26+
runs-on: ubuntu-latest
27+
steps:
28+
- name: Checkout
29+
uses: actions/checkout@v4
30+
- name: Install dependencies
31+
run: npm ci
32+
- name: Run format check
33+
run: npm run format
34+
35+
audit:
36+
runs-on: ubuntu-latest
37+
steps:
38+
- name: Checkout
39+
uses: actions/checkout@v4
40+
- name: Install dependencies
41+
run: npm ci
42+
- name: Run npm audit
43+
run: npm run audit
44+
45+
test:
46+
runs-on: ubuntu-latest
47+
steps:
48+
- name: Checkout
49+
uses: actions/checkout@v4
50+
- name: Install dependencies
51+
run: npm ci
52+
- name: Run tests
53+
run: npm test
54+
55+
secret_detection:
56+
runs-on: ubuntu-latest
57+
steps:
58+
- name: Checkout
59+
uses: actions/checkout@v4
60+
with:
61+
fetch-depth: 0
62+
- name: Install and run secret detection
63+
run: |
64+
wget https://github.com/gitleaks/gitleaks/releases/download/v8.18.4/gitleaks_8.18.4_linux_x64.tar.gz
65+
tar -xzf gitleaks_8.18.4_linux_x64.tar.gz
66+
EXITCODE=0
67+
./gitleaks detect -r ${SECRET_DETECTION_JSON_REPORT_FILE} --source . --log-opts="--all --full-history" || EXITCODE=$?
68+
if [[ $EXITCODE -ne 0 ]]; then
69+
exit $EXITCODE
70+
fi
71+
- name: Upload secret detection artifact
72+
if: always()
73+
uses: actions/upload-artifact@v4
74+
with:
75+
name: secret-detection-results
76+
path: gitleaks.json

.gitlab-ci.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Note: This GitLab CI configuration is used for internal testing, users can ignore it.
2+
include:
3+
- project: "${CI_PROJECT_NAMESPACE}/oss-ci-lib"
4+
file: "/${CI_PROJECT_NAME}/.gitlab-ci.yml"

.releaserc.json

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
{
2+
"branches": ["main"],
3+
"plugins": [
4+
[
5+
"@semantic-release/commit-analyzer",
6+
{
7+
"preset": "conventionalcommits",
8+
"releaseRules": [
9+
{ "type": "build", "release": false },
10+
{ "type": "ci", "release": false },
11+
{ "type": "docs", "release": false },
12+
{ "type": "feat", "release": "minor" },
13+
{ "type": "fix", "release": "patch" },
14+
{ "type": "patch", "release": "patch" }
15+
]
16+
}
17+
],
18+
[
19+
"@semantic-release/release-notes-generator",
20+
{
21+
"preset": "conventionalcommits",
22+
"presetConfig": {
23+
"types": [
24+
{ "type": "build", "hidden": true },
25+
{ "type": "ci", "hidden": true },
26+
{ "type": "docs", "hidden": true },
27+
{ "type": "feat", "section": "Added" },
28+
{ "type": "patch", "section": "Changed" },
29+
{ "type": "fix", "section": "Fixed" }
30+
]
31+
}
32+
}
33+
],
34+
["@semantic-release/changelog", { "changelogFile": "CHANGELOG.md" }],
35+
"@semantic-release/npm",
36+
[
37+
"@semantic-release/git",
38+
{
39+
"assets": ["package.json", "package-lock.json", "CHANGELOG.md"],
40+
"message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
41+
}
42+
],
43+
[
44+
"@semantic-release/gitlab",
45+
{
46+
"gitlabUrl": "https://gitlab.com",
47+
"assets": [{ "path": "CHANGELOG.md" }]
48+
}
49+
]
50+
]
51+
}

0 commit comments

Comments
 (0)