Skip to content

Commit d960eaf

Browse files
authored
Add check for production nitric version. (#152)
2 parents c24290b + 00e2acf commit d960eaf

File tree

3 files changed

+40
-0
lines changed

3 files changed

+40
-0
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Check Nitric Version
2+
3+
on:
4+
pull_request:
5+
- main
6+
7+
jobs:
8+
build:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Checkout
12+
uses: actions/checkout@v2
13+
- name: Cache Yarn Cache
14+
uses: actions/cache@v2
15+
with:
16+
path: 'node_modules'
17+
key: ${{ runner.os }}-modules-${{ hashFiles('yarn.lock') }}
18+
- name: Install modules
19+
run: yarn --frozen-lockfile
20+
- name: Check nitric version
21+
run: yarn check-nitric

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
"bump": "standard-version",
1111
"build": "tsup src/index.ts --dts --outDir lib",
1212
"test": "jest",
13+
"check-nitric": "ts-node ./scripts/check-nitric-version.ts",
1314
"test:coverage": "jest --coverage",
1415
"coverage:upload": "yarn run test:coverage && codecov",
1516
"prettier:check": "prettier --check src",

scripts/check-nitric-version.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// Copyright 2021, Nitric Technologies Pty Ltd.
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
import { nitric } from "../package.json"
15+
16+
if (nitric.includes("-rc")) {
17+
throw new Error("nitric must be set to a production version!");
18+
}

0 commit comments

Comments
 (0)