Skip to content

Commit

Permalink
build: add semantic-release
Browse files Browse the repository at this point in the history
  • Loading branch information
skarab42 committed Apr 4, 2022
1 parent 62958ce commit 57c069b
Show file tree
Hide file tree
Showing 4 changed files with 1,614 additions and 10 deletions.
9 changes: 9 additions & 0 deletions .github/.codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
comment: false

coverage:
range: 50..90
status:
project:
default:
target: auto
threshold: 1%
78 changes: 78 additions & 0 deletions .github/workflows/CI.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
name: CI

on:
push:
branches:
- main
pull_request:
branches:
- "*"

jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
node: ["14"]
typescript: ["4.4"]
name: Test with TypeScript ${{ matrix.typescript }} on Node ${{ matrix.node }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node }}
- uses: pnpm/[email protected]
with:
version: 6.32.1
- run: pnpm install
- run: pnpm add typescript@${{ matrix.typescript }}
- run: pnpm test-coverage

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v2
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage/lcov.info
fail_ci_if_error: true
verbose: true

lint:
runs-on: ubuntu-latest
needs: [test]
strategy:
matrix:
node: ["14"]
name: Lint and Fix
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node }}
- uses: pnpm/[email protected]
with:
version: 6.32.1
- run: pnpm install
- run: pnpm lint-fix

publish:
if: ${{ github.ref == 'refs/heads/main' }}
runs-on: ubuntu-latest
needs: [test, lint]
strategy:
matrix:
node: ["14"]
name: Build and publish on NPM
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node }}
- uses: pnpm/[email protected]
with:
version: 6.32.1
- run: pnpm install
- run: pnpm build
- run: pnpm semantic-release
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
21 changes: 16 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,14 @@
"up-hooks": "npx simple-git-hooks",
"prepare": "pnpm up-hooks",
"build": "tsup",
"start": "node dist/index.js",
"dev": "tsup --watch",
"test": "tsc --noEmit && vitest run",
"test-watch": "vitest watch",
"test-coverage": "vitest run --coverage",
"test-coverage": "tsc --noEmit && vitest run --coverage",
"format": "prettier --write ./**/*{.js,.ts,.json,.md} --ignore-path .gitignore",
"lint": "eslint --ext \".js,.ts\" --max-warnings=0 --ignore-path .gitignore .",
"lint-fix": "pnpm lint --fix"
"lint-fix": "pnpm lint --fix",
"semantic-release": "semantic-release --branches main"
},
"engines": {
"node": ">=12",
Expand All @@ -59,13 +59,24 @@
"eslint-plugin-prettier": "^4.0.0",
"lint-staged": "^12.3.7",
"prettier": "^2.6.1",
"semantic-release": "^19.0.2",
"simple-git-hooks": "^2.7.0",
"tsup": "^5.12.1",
"typescript": "^4.6.3",
"v8": "^0.1.0",
"vitest": "^0.8.1"
},
"peerDependencies": {
"typescript": "^4.6.3"
}
},
"keywords": [
"typed",
"pojo",
"error",
"exception",
"serializable",
"typescript",
"type-safe",
"types",
"json"
]
}

0 comments on commit 57c069b

Please sign in to comment.