Skip to content

Commit dfbe3a7

Browse files
Added build ci (#1)
1 parent d8d7c8d commit dfbe3a7

File tree

3 files changed

+94
-1
lines changed

3 files changed

+94
-1
lines changed

.github/workflows/ci.yml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
paths-ignore:
6+
- '*.md'
7+
branches: [ main ]
8+
tags:
9+
- '*'
10+
pull_request:
11+
branches: [ main ]
12+
13+
jobs:
14+
build:
15+
runs-on: ubuntu-latest
16+
steps:
17+
18+
- name: Git checkout
19+
uses: actions/checkout@v3
20+
with:
21+
fetch-depth: 0
22+
23+
- name: Setup Node.js
24+
uses: actions/setup-node@v3
25+
with:
26+
node-version: '16'
27+
28+
- name: Cache node_modules
29+
uses: actions/cache@v3
30+
with:
31+
path: |
32+
~/.npm
33+
~/.nvm
34+
~/work/better-sqlite3-websql/better-sqlite3-websql/node_modules
35+
~/work/better-sqlite3-websql/better-sqlite3-websql/package-lock.json
36+
key: ${{ runner.os }}-node_modules-cache-v3-${{ hashFiles('**/package-lock.json') }}
37+
restore-keys: |
38+
${{ runner.os }}-node_modules-cache-v3-
39+
40+
- name: Extract Tag Name
41+
run: echo "TAG_NAME=$(echo ${GITHUB_REF##*/})" >> $GITHUB_ENV
42+
if: ${{ startsWith(github.ref, 'refs/tags') }}
43+
44+
- name: Run tests
45+
run: |
46+
npm i
47+
node --test
48+
if: ${{ env.TAG_NAME == '' }}
49+
50+
- name: Build SNAPSHOT
51+
run: npm pack
52+
if: ${{ env.TAG_NAME == '' }}
53+
54+
- name: Publish RELEASE
55+
run: |
56+
VERSION="$(echo "$TAG_NAME" | cut -d'v' -f 2)"
57+
echo "Publish a release version=$VERSION for tag $TAG_NAME"
58+
npm --no-git-tag-version --allow-same-version version $VERSION
59+
npm pack
60+
echo "//registry.npmjs.org/:_authToken=\${NPM_TOKEN}" > .npmrc
61+
npm publish --access=public farjs-better-sqlite3-websql-${VERSION}.tgz
62+
if: ${{ env.TAG_NAME != '' }}
63+
env:
64+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

.github/workflows/ci_bun.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Bun CI
2+
3+
on:
4+
push:
5+
paths-ignore:
6+
- '*.md'
7+
branches: [ main ]
8+
pull_request:
9+
branches: [ main ]
10+
11+
jobs:
12+
build:
13+
runs-on: ubuntu-latest
14+
steps:
15+
16+
- name: Git checkout
17+
uses: actions/checkout@v3
18+
with:
19+
fetch-depth: 0
20+
21+
- name: Setup Bun
22+
uses: oven-sh/setup-bun@v1
23+
with:
24+
bun-version: "0.5.8"
25+
26+
- name: Run tests
27+
run: |
28+
bun install
29+
bun test

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,6 @@
3333
},
3434
"dependencies": {
3535
"@expo/websql": "^1.0.1",
36-
"@farjs/better-sqlite3-wrapper": "../better-sqlite3-wrapper"
36+
"@farjs/better-sqlite3-wrapper": "^1.0.0"
3737
}
3838
}

0 commit comments

Comments
 (0)