Skip to content

Commit 4aac658

Browse files
committed
add ci/cd
1 parent a128799 commit 4aac658

File tree

3 files changed

+126
-0
lines changed

3 files changed

+126
-0
lines changed

.github/dependabot.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
version: 2
2+
3+
updates:
4+
- package-ecosystem: "npm"
5+
directory: "/"
6+
schedule:
7+
interval: "monthly"
8+
groups:
9+
all-dependencies:
10+
patterns:
11+
- "*"
12+
13+
- package-ecosystem: "github-actions"
14+
directory: "/"
15+
schedule:
16+
interval: "monthly"
17+
groups:
18+
all-dependencies:
19+
patterns:
20+
- "*"

.github/workfows/bump-version.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Compare Mapping and Bump Version
2+
3+
on:
4+
workflow_dispatch:
5+
schedule:
6+
# Run once a month at midnight on the first day
7+
- cron: '0 0 1 * *'
8+
9+
jobs:
10+
compare-and-bump:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Checkout repository
15+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
16+
17+
- name: Set up Node.js
18+
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
19+
with:
20+
node-version: lts/*
21+
cache: npm
22+
registry-url: 'https://registry.npmjs.org'
23+
24+
- name: Install dependencies
25+
run: npm ci
26+
27+
- name: Build project
28+
run: npm run build
29+
30+
- name: Compare with npm package
31+
id: compare
32+
run: |
33+
# Create temp directory and set paths
34+
TMP_DIR=$(mktemp -d)
35+
36+
# Fetch package from npm and extract index.js
37+
PACKAGE_URL=$(npm view unicode-case-folding dist.tarball)
38+
curl -sL "$PACKAGE_URL" -o "$TMP_DIR/package.tgz"
39+
tar -xzf "$TMP_DIR/package.tgz" -C "$TMP_DIR"
40+
41+
# Compare files and set output
42+
if diff -q "index.js" "$TMP_DIR/package/index.js"; then
43+
echo "result=same" >> $GITHUB_OUTPUT
44+
else
45+
echo "result=different" >> $GITHUB_OUTPUT
46+
fi
47+
48+
- name: Bump patch version
49+
if: steps.compare.outputs.result == 'different'
50+
run: |
51+
# Configure Git
52+
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
53+
git config --local user.name "github-actions[bot]"
54+
55+
# Get current version and bump patch
56+
npm version patch -m "Bump version to %s"
57+
npm publish
58+
59+
# Push changes back to the repository
60+
git push

.github/workfows/lint-and-test.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Lint and Test
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
lint:
11+
name: Lint
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout repository
15+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
16+
17+
- name: Set up Node.js
18+
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
19+
with:
20+
node-version: lts/*
21+
cache: npm
22+
23+
- name: Install dependencies
24+
run: npm ci
25+
26+
- name: Lint and check formatting
27+
run: npm run lint && npm run format:check
28+
29+
test:
30+
name: Test
31+
runs-on: ubuntu-latest
32+
steps:
33+
- name: Checkout repository
34+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
35+
36+
- name: Set up Node.js
37+
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
38+
with:
39+
node-version: lts/*
40+
cache: npm
41+
42+
- name: Install dependencies
43+
run: npm ci
44+
45+
- name: Run tests
46+
run: npm test

0 commit comments

Comments
 (0)