-
Notifications
You must be signed in to change notification settings - Fork 18
88 lines (85 loc) · 2.99 KB
/
node.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
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
name: Node CI with NPM
on:
push:
branches:
- master
- "release/**"
pull_request:
branches:
- master
- "release/**"
workflow_dispatch:
release:
types:
- published
schedule:
- cron: "0 12 * * 0" # Every Sunday, at midday
jobs:
integration-tests:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x, 20.x, 21.x, 22.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Get npm cache directory
id: npm-cache-dir
shell: bash
run: echo "dir=$(npm config get cache)" >> ${GITHUB_OUTPUT}
- uses: actions/cache@v4
id: cache
with:
path: ${{ steps.npm-cache-dir.outputs.dir }}
key: ${{ runner.os }}-node${{ matrix.node-version }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node${{ matrix.node-version }}-
- name: Install dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: npm ci
- name: Run linter over tests
run: |
npm install prettier
npx prettier -c test/**/*.ts
- name: Run integration tests with NPM
if: ${{ matrix.node-version == '18.x' &&
github.repository_owner == 'onfido' }}
run: npm test -- -i
env:
ONFIDO_API_TOKEN: ${{ secrets.ONFIDO_API_TOKEN }}
ONFIDO_SAMPLE_APPLICANT_ID: ${{ secrets.ONFIDO_SAMPLE_APPLICANT_ID }}
ONFIDO_SAMPLE_VIDEO_ID_1: ${{ secrets.ONFIDO_SAMPLE_VIDEO_ID_1 }}
ONFIDO_SAMPLE_VIDEO_ID_2: ${{ secrets.ONFIDO_SAMPLE_VIDEO_ID_2 }}
ONFIDO_SAMPLE_MOTION_ID_1: ${{ secrets.ONFIDO_SAMPLE_MOTION_ID_1 }}
ONFIDO_SAMPLE_MOTION_ID_2: ${{ secrets.ONFIDO_SAMPLE_MOTION_ID_2 }}
publish:
runs-on: ubuntu-latest
needs: integration-tests
environment: delivery
if: github.event_name == 'release'
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.GH_ACTION_ACCESS_TOKEN }}
ref: master
- uses: actions/setup-node@v4
with:
node-version: 18.x
registry-url: https://registry.npmjs.org/
- name: Validate release
uses: onfido/onfido-actions/release-check@main
- name: Install dependencies
run: npm ci
- name: Build and publish package
run: |
npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.npm_token }}
- name: Update and commit CHANGELOG.md
uses: onfido/onfido-actions/update-changelog@main