Skip to content

Commit 2834912

Browse files
committed
Add CI and release workflows
1 parent 8de034f commit 2834912

3 files changed

Lines changed: 97 additions & 0 deletions

File tree

.github/pull_request_template.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<!--
2+
Please explain the motivation behind the changes.
3+
4+
In other words, explain **WHY** instead of **WHAT**.
5+
6+
If you are adding a new config option in a component, please explain the use case with an example.
7+
-->

.github/workflows/ci.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
schedule:
8+
- cron: "0 0 * * *"
9+
10+
jobs:
11+
12+
unit-tests:
13+
name: Unit tests
14+
runs-on: ubuntu-latest
15+
strategy:
16+
matrix:
17+
node:
18+
- 14
19+
- 16
20+
- 18
21+
steps:
22+
- uses: actions/checkout@v2
23+
- uses: actions/setup-node@v2
24+
with:
25+
node-version: ${{ matrix.node }}
26+
- uses: actions/cache@v2
27+
with:
28+
path: ~/.npm
29+
key: ${{ runner.os }}-node-${{ matrix.node }}-${{ hashFiles('**/package.json') }}
30+
- run: npm i
31+
- run: npm test
32+
33+
lint:
34+
name: Lint
35+
runs-on: ubuntu-latest
36+
steps:
37+
- uses: actions/checkout@v2
38+
- uses: actions/setup-node@v2
39+
with:
40+
node-version: 18
41+
- uses: actions/cache@v2
42+
with:
43+
path: ~/.npm
44+
key: ${{ runner.os }}-node-${{ hashFiles('**/package.json') }}
45+
- run: npm i
46+
- run: npm run lint
47+
48+
types:
49+
name: Check types
50+
runs-on: ubuntu-latest
51+
steps:
52+
- uses: actions/checkout@v2
53+
- uses: actions/setup-node@v2
54+
with:
55+
node-version: 18
56+
- uses: actions/cache@v2
57+
with:
58+
path: ~/.npm
59+
key: ${{ runner.os }}-node-${{ hashFiles('**/package.json') }}
60+
- run: npm i
61+
- name: Typescript checks
62+
run: tsc --noEmit

.github/workflows/release.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Release
2+
3+
on:
4+
# This job runs when a new release is published
5+
release:
6+
types: [published]
7+
8+
jobs:
9+
release:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v2
13+
- uses: actions/setup-node@v2
14+
with:
15+
node-version: 18
16+
registry-url: https://registry.npmjs.org
17+
- uses: actions/cache@v2
18+
with:
19+
path: ~/.npm
20+
key: ${{ runner.os }}-node-${{ hashFiles('**/package.json') }}
21+
# Store the name of the release
22+
# See https://stackoverflow.com/questions/58177786/get-the-current-pushed-tag-in-github-actions
23+
- run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
24+
- run: npm i
25+
- run: npm version $RELEASE_VERSION --no-git-tag-version
26+
- run: npm publish --access public
27+
env:
28+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

0 commit comments

Comments
 (0)