Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CAT-1120] Improve npm release #116

Merged
merged 10 commits into from
May 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 21 additions & 24 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,42 +7,39 @@ on:
push:
branches:
- master
- 'release/**'
- "release/**"
pull_request:
branches:
- master
- 'release/**'
- "release/**"
workflow_dispatch:

jobs:
build:

runs-on: ubuntu-latest

strategy:
matrix:
node-version: [16.x, 18.x, 20.x, 21.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/

steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Install dependencies
run: npm ci
- name: Run linter over tests
run: npx prettier -c test/**/*.ts
- name: Run integration tests with NPM
if: ${{ matrix.node-version == '16.x' &&
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Install dependencies
run: npm ci
- name: Run linter over tests
run: npx prettier -c test/**/*.ts
- name: Run integration tests with NPM
if: ${{ matrix.node-version == '16.x' &&
github.repository_owner == 'onfido' &&
github.actor != 'dependabot[bot]' }}
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 }}
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 }}
47 changes: 25 additions & 22 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
@@ -1,42 +1,45 @@
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
# For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages

name: Node.js Package
name: Node.js Package with NPM

on:
release:
types: [created]
types:
- created

jobs:
build:
integration-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 14
- run: npm ci
- name: E2E testing
run: npm test -i
node-version: 16.x
- name: Install dependencies
run: npm ci
- name: Run integration tests with NPM
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}}
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-npm:
needs: build
needs: integration-tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 12
node-version: 16.x
registry-url: https://registry.npmjs.org/
- run: npm ci
- run: npm run build
- run: npm publish
- name: Install dependencies
run: npm ci
- name: Build and publish package
run: npm publish
env:
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
Empty file removed .openapi-generator-ignore
Empty file.
15 changes: 0 additions & 15 deletions .openapi-generator/FILES

This file was deleted.

57 changes: 0 additions & 57 deletions git_push.sh

This file was deleted.

15 changes: 11 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@onfido/api",
"version": "3.0.0",
"description": "OpenAPI client for @onfido/api",
"description": "Node.js library for the Onfido API",
"author": "OpenAPI-Generator Contributors",
"repository": {
"type": "git",
Expand All @@ -12,18 +12,25 @@
"typescript",
"openapi-client",
"openapi-generator",
"@onfido/api"
"@onfido/api",
"onfido",
"identity",
"verification",
"api"
],
"license": "MIT",
"license": "MIT",
"main": "./dist/index.js",
"typings": "./dist/index.d.ts",
"module": "./dist/esm/index.js",
"sideEffects": false,
"scripts": {
"test": "jest",
"test": "jest",
"build": "tsc && tsc -p tsconfig.esm.json",
"prepare": "npm run build"
},
"files": [
"/dist"
],
Comment on lines +31 to +33
Copy link
Contributor Author

@dvacca-onfido dvacca-onfido May 6, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is to obtain same package structure in npm archive as old npm package (v2.9.0).

Example of a npm package session (with --dry-run option):

npm notice 
npm notice 📦  @onfido/[email protected]
npm notice === Tarball Contents === 
npm notice 1.1kB   LICENSE                             
npm notice 5.4kB   README.md                           
npm notice 373.[8](https://github.com/onfido/onfido-node/actions/runs/8969224299/job/24630303554#step:5:9)kB dist/api.d.ts                       
npm notice 2[9](https://github.com/onfido/onfido-node/actions/runs/8969224299/job/24630303554#step:5:10)2.1kB dist/api.js                         
npm notice 1.4kB   dist/base.d.ts                      
npm notice 1.5kB   dist/base.js                        
npm notice 1.8kB   dist/common.d.ts                    
npm notice 7.2kB   dist/common.js                      
npm notice 2.5kB   dist/configuration.d.ts             
npm notice 2.2kB   dist/configuration.js               
npm notice 373.8kB dist/esm/api.d.ts                   
npm notice 283.0kB dist/esm/api.js                     
npm notice 1.4kB   dist/esm/base.d.ts                  
npm notice 1.2kB   dist/esm/base.js                    
npm notice 1.8kB   dist/esm/common.d.ts                
npm notice 6.4kB   dist/esm/common.js                  
npm notice 2.5kB   dist/esm/configuration.d.ts         
npm notice 2.0kB   dist/esm/configuration.js           
npm notice 366B    dist/esm/index.d.ts                 
npm notice 408B    dist/esm/index.js                   
npm notice 340B    dist/esm/webhook-event-verifier.d.ts
npm notice 1.2kB   dist/esm/webhook-event-verifier.js  
npm notice 366B    dist/index.d.ts                     
npm notice 1.2kB   dist/index.js                       
npm notice 340B    dist/webhook-event-verifier.d.ts    
npm notice 1.4kB   dist/webhook-event-verifier.js      
npm notice 1.4kB   package.json                        
npm notice === Tarball Details === 
npm notice name:          @onfido/api                             
npm notice version:       3.0.0                                   
npm notice filename:      @onfido/api-3.0.0.tgz                   
npm notice package size:  [12](https://github.com/onfido/onfido-node/actions/runs/8969224299/job/24630303554#step:5:13)2.5 kB                                
npm notice unpacked size: 1.4 MB                                  
npm notice shasum:        01d87704ed4dbf4387d6ac83776bf49eb5f74907
npm notice integrity:     sha512-03gzgmw0lJ9MX[...]krm/h7EIAueSQ==
npm notice total files:   27                                      
npm notice 
npm WARN This command requires you to be logged in to github:onfido/onfido-node (dry-run)
npm notice Publishing to github:onfido/onfido-node (dry-run)
+ @onfido/[email protected]

Change will be persisted in template via onfido/onfido-openapi-spec@3864e6d.

"jest": {
"preset": "ts-jest",
"testEnvironment": "node",
Expand Down
2 changes: 1 addition & 1 deletion test/resources/workflow-runs-outputs.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ describe("workflow runs outputs", () => {
);
});

it.only("allows document and facial similarity photo reports as outputs", async () => {
it("allows document and facial similarity photo reports as outputs", async () => {
const workflow_id = "5025d9fd-7842-4805-bce1-a7bfd7131b4e";
const workflowRunId = (await createWorkflowRun(applicant, workflow_id)).data
.id;
Expand Down
Loading