Add actions for pr, publish

This commit is contained in:
Todd Baert 2022-05-11 14:02:30 -04:00
parent dac783faa8
commit e93186b8ec
No known key found for this signature in database
GPG Key ID: 6832CDB677D5E06D
7 changed files with 75 additions and 4 deletions

View File

29
.github/workflows/pr-checks.yaml vendored Normal file
View File

@ -0,0 +1,29 @@
name: pr-checks
on:
pull_request:
types: [opened, synchronize, reopened]
branches:
- main
jobs:
build-test-lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- name: Install
run: npm ci
- name: Lint
run: npm run lint
- name: Build
run: npm run build
- name: Test
run: npm run test

40
.github/workflows/publish-dev.yaml vendored Normal file
View File

@ -0,0 +1,40 @@
# Publishes a pre-release, incrementing the final integer (ie: 0.0.1-alpha.1 => 0.0.1-alpha.2), if any ts files or the package.json have changed. Pushes package.json changes back to main.
name: publish-dev
on:
push:
branches:
- main
paths:
- '**.ts'
- 'package.json'
- 'package-lock.json'
jobs:
publish-dev:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- name: Install
run: npm ci
- name: Build
run: npm run build
- name: Version
run: npm version prerelease
- name: Publish
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Push Version Update
run: |
git config --global user.name 'openfeature-ci'
git config --global user.email 'openfeature-ci@users.noreply.github.com'
git push

View File

@ -1,5 +1,7 @@
# node-sdk # node-sdk
[![experimental](http://badges.github.io/stability-badges/dist/experimental.svg)](http://github.com/badges/stability-badges)
OpenFeature NodeJS SDK OpenFeature NodeJS SDK
## Development ## Development

View File

@ -8,7 +8,7 @@
"test": "jest", "test": "jest",
"lint": "eslint ./", "lint": "eslint ./",
"postbuild": "cp ./package.esm.json ./dist/esm/package.json", "postbuild": "cp ./package.esm.json ./dist/esm/package.json",
"build": "rm -R ./dist && tsc --project tsconfig.json && tsc --project tsconfig.cjs.json" "build": "rm -f -R ./dist && tsc --project tsconfig.json && tsc --project tsconfig.cjs.json"
}, },
"repository": { "repository": {
"type": "git", "type": "git",

View File

@ -1,5 +1,5 @@
// real code will go here, just scaffolding the project for now. // real code will go here, just scaffolding the project for now.
export const greet = (greeting: string): string => { export const greet = (greeting: string): string => {
console.log(`${greeting}, OpenFeature`); const message = `${greeting}, OpenFeature`;
return greeting; return message;
}; };

View File

@ -3,6 +3,6 @@ import { greet } from '../src/index';
describe('greet', () => { describe('greet', () => {
it('should return greeting', () => { it('should return greeting', () => {
const result = greet('hi'); const result = greet('hi');
expect(result).toEqual('hi'); expect(result).toContain('hi');
}); });
}); });