-
-
Notifications
You must be signed in to change notification settings - Fork 83
65 lines (63 loc) · 1.78 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
name: CI
on:
push:
branches: ["main"]
tags: ["*"]
pull_request:
branches: ["main"]
jobs:
test:
name: Test
runs-on: ubuntu-latest
strategy:
matrix:
project_dir:
- .
- examples/express
- examples/express-apikey-auth
- examples/express-jwt-auth
- examples/express-ts-mock
- examples/express-typescript
- examples/fastify
- examples/hapi-typescript
- examples/koa
- examples/serverless-framework
- examples/aws-sam
- examples/aws-cdk
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "16"
- uses: actions/setup-python@v5
with:
python-version: "3.8"
- uses: aws-actions/setup-sam@v2
if: matrix.project_dir == 'examples/aws-sam' || matrix.project_dir == 'examples/aws-cdk'
- run: npm ci && npm run build
- run: npm ci
working-directory: ${{ matrix.project_dir }}
- run: npm link ../../
if: matrix.project_dir != '.' && matrix.project_dir != 'examples/aws-sam'
working-directory: ${{ matrix.project_dir }}
- run: npm run lint
if: matrix.project_dir == '.'
working-directory: ${{ matrix.project_dir }}
- run: npm test
working-directory: ${{ matrix.project_dir }}
publish:
name: Publish
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
needs:
- test
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "18"
registry-url: https://registry.npmjs.org/
- run: npm ci
- run: npm publish || true
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}