Skip to content

Commit

Permalink
Merge pull request #14 from Bandwidth/DX-3033
Browse files Browse the repository at this point in the history
Dx 3033 Migrate to Public NPM
  • Loading branch information
ajrice6713 authored Jan 12, 2023
2 parents 3994363 + 6db2b28 commit d15cbef
Show file tree
Hide file tree
Showing 8 changed files with 1,163 additions and 4,012 deletions.
33 changes: 14 additions & 19 deletions .github/workflows/deploy-beta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,6 @@ jobs:
runs-on: ubuntu-latest
if: ${{ github.event.release.prerelease }}
steps:
- name: Check Branch Name Format
run: |
re=v[0-9]+.[0-9]+.[0-9]+-beta
if ! [[ ${{ github.event.release.target_commitish }} =~ $re ]]; then
echo 'Target branch does not match expected regex pattern for beta releases (v[0-9]+.[0-9]+.[0-9]+-beta)'
echo '${{ github.event.release.target_commitish }}'
echo 'Please update your branch name to match the expected regex pattern'
exit 1
fi
- name: Set Release Version
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/v}" >> $GITHUB_ENV

Expand All @@ -32,20 +22,25 @@ jobs:
echo 'Please update your tag to match the expected regex pattern'
exit 1
fi
- name: Checkout
uses: actions/checkout@v3

- name: Setup Node
uses: actions/setup-node@v2
uses: actions/setup-node@v3
with:
node-version: '16'
registry-url: 'https://npm.pkg.github.com'
node-version: "18"
registry-url: 'https://registry.npmjs.org'

- name: Build and Test npm Package
run: |
npm install
npm run build
npm run test
npm install
npm run build
npm run test
- name: Publish npm Package
run: |
npm version $RELEASE_VERSION --no-git-tag-version
npm publish --tag beta
npm version $RELEASE_VERSION --no-git-tag-version
npm publish --access public --tag beta
env:
NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }}
40 changes: 20 additions & 20 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,27 +9,27 @@ jobs:
runs-on: ubuntu-latest
if: ${{ !github.event.release.prerelease && github.event.release.target_commitish == 'main' }}
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Checkout
uses: actions/checkout@v3

- name: Set Release Version
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/v}" >> $GITHUB_ENV
- name: Set Release Version
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/v}" >> $GITHUB_ENV

- name: Setup Node
uses: actions/setup-node@v2
with:
node-version: '16'
registry-url: 'https://npm.pkg.github.com'
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: "18"
registry-url: 'https://registry.npmjs.org'

- name: Build and Test npm Package
run: |
npm install
npm run build
npm run test
- name: Build and Test npm Package
run: |
npm install
npm run build
npm run test
- name: Publish npm Package
run: |
npm version $RELEASE_VERSION --no-git-tag-version
npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Publish npm Package
run: |
npm version $RELEASE_VERSION --no-git-tag-version
npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }}
25 changes: 14 additions & 11 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,21 @@ on:

jobs:
test:
name: Test
name: Test
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [14, 16, 18, 'latest']
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Checkout
uses: actions/checkout@v3

- name: Setup Node
uses: actions/setup-node@v2
with:
node-version: 16
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}

- name: Test
run: |
npm install
npm run test
- name: Test
run: |
npm install
npm run test
30 changes: 17 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,30 +1,34 @@
# oas-linter-cli

This is a CLI tool that enables users to run an OAS (Open API Spec) file through the DevX ruleset before opening a pull request against [api-specs](https://github.com/Bandwidth/api-specs)
This is a CLI tool that enables users to run an OAS (Open API Spec) file through Bandwidth's custom [Stoplight ruleset](https://docs.stoplight.io/docs/spectral/e5b9616d6d50c-rulesets).

## Setup and Install

```sh
# if your npm profile isnt setup to download npm packages published to githubs npm registry - run these commands first
npm login --registry https://npm.pkg.github.com # Requires a github token with Bandwidth SSO access
npm config set @Bandwidth:registry https://npm.pkg.github.com

# note the uppercase `B`
npm install -g @Bandwidth/oas-linter-cli
npm install -g @bandwidth/oas-linter-cli
```

## Usage

```sh
bw-oas-lint -h # Help
bw-oas-lint lint ../path/to/my/spec.yml # must be in Yaml format

# add -s flag to save the terminal output to a .json file in your home directory
bw-oas-linter lint ../path/to/my/spec.yml # json also supported
```

## Uninstall
### Options

Run `bw-oas-linter lint -h` for a list of options.

| Flag | Description |
|:----:|:------------|
| -s | Save linter result to users home directory |
| -j | Output JSON |
| -r | Path to custom spectral ruleset file |
| -h | Print help menu |
| -v | Print package version |


## Uninstall

```sh
# note the lowercase `b`
npm uninstall -g @bandwidth/oas-linter-cli
```
Loading

0 comments on commit d15cbef

Please sign in to comment.