-
Notifications
You must be signed in to change notification settings - Fork 228
89 lines (74 loc) · 2.05 KB
/
build.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
name: Build and Publish Httpsnippet
on:
push:
branches:
- master
tags:
- '*' # Restrict any specific tag formats
pull_request:
types:
- opened
- synchronize
workflow_dispatch:
jobs:
scan:
permissions:
packages: write
contents: write # publish sbom to GH releases/tag assets
runs-on: ubuntu-latest
steps:
- name: Checkout branch
uses: actions/checkout@v3
with:
path: ${{ github.repository }}
# Perform SCA analysis for the code repository
# Produces SBOM and CVE report
# Helps understand vulnerabilities / license compliance across third party dependencies
- id: sca-project
uses: Kong/public-shared-actions/security-actions/sca@2f02738ecb1670f01391162e43fe3f5d4e7942a1 # v2.2.2
with:
dir: ${{ github.repository }}
upload-sbom-release-assets: true
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
node-version: [16, 18, 20]
steps:
- name: Checkout branch
uses: actions/checkout@v3
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Install
run: npm ci
- name: Test
run: npm run test
- name: Lint
run: npm run lint
- name: Build
run: npm run build
publish:
runs-on: ubuntu-latest
if: ${{ github.ref_type == 'tag' && github.repository_owner == 'Kong' }}
steps:
# checkout tag
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20.9.0
registry-url: 'https://registry.npmjs.org'
- name: Install
run: npm ci
- name: Build
run: npm run build
- name: Publish to NPM
run: npm publish --no-git-checks --provenance --tag ${{ github.sha }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}