Skip to content

Commit 64e9b33

Browse files
committed
ci: init build test and publish
1 parent 34c221a commit 64e9b33

File tree

2 files changed

+60
-0
lines changed

2 files changed

+60
-0
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Build and Test
2+
3+
on: [ push, pull_request, release ]
4+
5+
jobs:
6+
test:
7+
name: Running jest
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@v3
11+
with:
12+
fetch-depth: 0
13+
- name: Use Node.js 18.x
14+
uses: actions/setup-node@v3
15+
with:
16+
node-version: "18.x"
17+
cache: "yarn"
18+
- name: Get yarn cache directory path
19+
id: yarn-cache-dir-path
20+
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
21+
- uses: actions/cache@v3
22+
id: yarn-cache
23+
with:
24+
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
25+
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
26+
restore-keys: |
27+
${{ runner.os }}-yarn-
28+
- name: Install Dependencies
29+
run: yarn install
30+
- name: Build
31+
run: yarn build
32+
- name: Test
33+
run: yarn test

.github/workflows/publish.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: publish to NPM
2+
on:
3+
release:
4+
types: [ published ]
5+
jobs:
6+
npm-publish:
7+
name: npm
8+
environment: Publish
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Checkout repository
12+
uses: actions/checkout@v2
13+
14+
- name: Use Node.js 18.x
15+
uses: actions/setup-node@v3
16+
with:
17+
node-version: '18.x'
18+
cache: 'yarn'
19+
registry-url: 'https://registry.npmjs.org'
20+
21+
- name: Install dependencies
22+
run: yarn install
23+
24+
- name: Publish to npm
25+
run: npm publish
26+
env:
27+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

0 commit comments

Comments
 (0)