Skip to content

Commit ccd23ec

Browse files
committedSep 11, 2021
Refactor GitHub Actions
1 parent 84bc232 commit ccd23ec

File tree

5 files changed

+136
-104
lines changed

5 files changed

+136
-104
lines changed
 

‎.github/workflows/build.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Build
2+
3+
on: pull_request
4+
5+
jobs:
6+
typescript_compiler:
7+
name: TypeScript compiler
8+
runs-on: ubuntu-latest
9+
10+
steps:
11+
- name: Checkout repository
12+
uses: actions/checkout@v2.3.4
13+
14+
- name: Cache dependencies
15+
id: cache
16+
uses: actions/cache@v2.1.6
17+
with:
18+
path: ./.npm
19+
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
20+
restore-keys: |
21+
${{ runner.os }}-npm-
22+
23+
- name: Setup Node.js
24+
uses: actions/setup-node@master
25+
with:
26+
node-version: '14.x'
27+
28+
- name: Install npm dependencies
29+
run: npm ci --prefer-offline --cache=./.npm
30+
31+
- name: Build library
32+
run: npx tsc

‎.github/workflows/code-quality.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Code quality
2+
3+
on: pull_request
4+
5+
jobs:
6+
eslint:
7+
name: ESLint
8+
runs-on: ubuntu-latest
9+
10+
steps:
11+
- name: Checkout repository
12+
uses: actions/checkout@v2.3.4
13+
14+
- name: Cache dependencies
15+
id: cache
16+
uses: actions/cache@v2.1.6
17+
with:
18+
path: ./.npm
19+
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
20+
restore-keys: |
21+
${{ runner.os }}-npm-
22+
23+
- name: Setup Node.js
24+
uses: actions/setup-node@master
25+
with:
26+
node-version: '14.x'
27+
28+
- name: Install npm dependencies
29+
run: npm ci --prefer-offline --cache=./.npm
30+
31+
- name: Lint with ESLint
32+
run: npx eslint . --max-warinings 0
33+
34+
prettier:
35+
name: Prettier
36+
runs-on: ubuntu-latest
37+
38+
steps:
39+
- name: Checkout repository
40+
uses: actions/checkout@v2.3.4
41+
42+
- name: Cache dependencies
43+
id: cache
44+
uses: actions/cache@v2.1.6
45+
with:
46+
path: ./.npm
47+
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
48+
restore-keys: |
49+
${{ runner.os }}-npm-
50+
51+
- name: Setup Node.js
52+
uses: actions/setup-node@master
53+
with:
54+
node-version: '14.x'
55+
56+
- name: Install npm dependencies
57+
run: npm ci --prefer-offline --cache=./.npm
58+
59+
- name: Lint with ESLint
60+
run: npx prettier --check .

‎.github/workflows/publish.yml

Lines changed: 0 additions & 44 deletions
This file was deleted.

‎.github/workflows/quality_assurance.yml

Lines changed: 0 additions & 60 deletions
This file was deleted.

‎.github/workflows/release.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Release
2+
3+
on:
4+
release:
5+
types:
6+
- published
7+
8+
jobs:
9+
build:
10+
name: npm Registry
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Checkout repository
15+
uses: actions/checkout@v2.3.4
16+
17+
- name: Cache dependencies
18+
id: cache
19+
uses: actions/cache@v2.1.6
20+
with:
21+
path: ./.npm
22+
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
23+
restore-keys: |
24+
${{ runner.os }}-npm-
25+
26+
- name: Setup Node.js
27+
uses: actions/setup-node@master
28+
with:
29+
node-version: '14.x'
30+
31+
- name: Install npm dependencies
32+
run: npm ci --prefer-offline --cache=./.npm
33+
34+
- name: Build library
35+
run: npx tsc
36+
37+
- name: Set version in package.json
38+
run: npm --no-git-tag-version version ${{ github.event.release.tag_name }}
39+
40+
- name: Set npm credentials
41+
run: npm config set //registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}
42+
43+
- name: Publish to npm Registry
44+
run: npm publish --access public

0 commit comments

Comments
 (0)