Skip to content

Commit ed1be93

Browse files
committed
ci: refactored package release by tag
1 parent 4faa0d0 commit ed1be93

File tree

3 files changed

+57
-9
lines changed

3 files changed

+57
-9
lines changed

.github/workflows/ci.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
8+
jobs:
9+
CI:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Begin CI...
14+
uses: actions/checkout@v2
15+
16+
- name: Use Node 12
17+
uses: actions/setup-node@v1
18+
with:
19+
node-version: lts/*
20+
21+
- name: Use cached node_modules
22+
uses: actions/cache@v1
23+
with:
24+
path: node_modules
25+
key: nodeModules-${{ hashFiles('**/yarn.lock') }}
26+
restore-keys: |
27+
nodeModules-
28+
- name: Install dependencies
29+
run: yarn install --frozen-lockfile
30+
env:
31+
CI: true
32+
33+
- name: Lint
34+
run: yarn lint
35+
env:
36+
CI: true
37+
38+
- name: Test
39+
run: yarn test:ci
40+
env:
41+
CI: true
42+
43+
- name: Build
44+
run: yarn build
45+
env:
46+
CI: true

.github/workflows/release.yml

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,20 @@
1-
name: Semantic Release
1+
name: Release
2+
23
on:
34
push:
4-
branches:
5-
- main
5+
tags:
6+
- v*
7+
68
jobs:
79
release:
810
name: Release
911
runs-on: ubuntu-latest
1012
steps:
1113
- uses: actions/checkout@v2
12-
- uses: actions/setup-node@v2
14+
- uses: actions/setup-node@v1
1315
with:
1416
node-version: lts/*
15-
- run: yarn
16-
- env:
17-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
18-
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
19-
run: npx semantic-release
17+
registry-url: https://registry.npmjs.org/
18+
- run: yarn && npm publish
19+
env:
20+
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
"example": "cd ./example && node run-in-ci.js",
4040
"lint": "eslint . --cache --fix --ext .ts,.tsx",
4141
"format": "prettier --loglevel warn --write \"**/*.{ts,tsx,css,md}\"",
42+
"test:ci": "yarn test --passWithNoTests",
4243
"test:jest": "jest",
4344
"test:watch": "jest --watch",
4445
"test:coverage": "jest --coverage",

0 commit comments

Comments
 (0)