Skip to content

Commit 1f88861

Browse files
committed
Refactor GitHub Action
1 parent ae998b7 commit 1f88861

File tree

5 files changed

+132
-104
lines changed

5 files changed

+132
-104
lines changed

.github/workflows/build.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
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/[email protected]
13+
14+
- name: Cache dependencies
15+
uses: actions/[email protected]
16+
with:
17+
path: ./.npm
18+
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
19+
restore-keys: |
20+
${{ runner.os }}-npm-
21+
22+
- name: Setup Node.js
23+
uses: actions/[email protected]
24+
with:
25+
node-version: '14.x'
26+
27+
- name: Install npm dependencies
28+
run: npm ci --prefer-offline --cache=./.npm
29+
30+
- name: Build library
31+
run: npx tsc

.github/workflows/code-quality.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
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/[email protected]
13+
14+
- name: Cache dependencies
15+
uses: actions/[email protected]
16+
with:
17+
path: ./.npm
18+
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
19+
restore-keys: |
20+
${{ runner.os }}-npm-
21+
22+
- name: Setup Node.js
23+
uses: actions/[email protected]
24+
with:
25+
node-version: '14.x'
26+
27+
- name: Install npm dependencies
28+
run: npm ci --prefer-offline --cache=./.npm
29+
30+
- name: Lint with ESLint
31+
run: npx eslint . --max-warinings 0
32+
33+
prettier:
34+
name: Prettier
35+
runs-on: ubuntu-latest
36+
37+
steps:
38+
- name: Checkout repository
39+
uses: actions/[email protected]
40+
41+
- name: Cache dependencies
42+
uses: actions/[email protected]
43+
with:
44+
path: ./.npm
45+
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
46+
restore-keys: |
47+
${{ runner.os }}-npm-
48+
49+
- name: Setup Node.js
50+
uses: actions/[email protected]
51+
with:
52+
node-version: '14.x'
53+
54+
- name: Install npm dependencies
55+
run: npm ci --prefer-offline --cache=./.npm
56+
57+
- name: Lint with ESLint
58+
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: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
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/[email protected]
16+
17+
- name: Cache dependencies
18+
uses: actions/[email protected]
19+
with:
20+
path: ./.npm
21+
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
22+
restore-keys: |
23+
${{ runner.os }}-npm-
24+
25+
- name: Setup Node.js
26+
uses: actions/[email protected]
27+
with:
28+
node-version: '14.x'
29+
30+
- name: Install npm dependencies
31+
run: npm ci --prefer-offline --cache=./.npm
32+
33+
- name: Build library
34+
run: npx tsc --outDir 3.1.0 # replace "3.1.0" with "." when another OpenAPI version will be added
35+
36+
- name: Set version in package.json
37+
run: npm --no-git-tag-version version ${{ github.event.release.tag_name }}
38+
39+
- name: Set npm credentials
40+
run: npm config set //registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}
41+
42+
- name: Publish to npm Registry
43+
run: npm publish --access public

0 commit comments

Comments
 (0)