Automate publishing to npm

Also the `lint` job has been split into `eslint` and `prettier`.

Closes #6
This commit is contained in:
Remco Haszing 2021-08-23 17:15:07 +02:00
parent 13a21cba5d
commit d1c499b224
No known key found for this signature in database
GPG key ID: 40D9F5FE9155FD3C
2 changed files with 24 additions and 4 deletions

View file

@ -7,6 +7,15 @@ on:
tags: ['*']
jobs:
eslint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with: { node-version: 16 }
- run: npm ci
- run: npx eslint .
pack:
runs-on: ubuntu-latest
steps:
@ -16,14 +25,14 @@ jobs:
- run: npm ci
- run: npm pack
lint:
prettier:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with: { node-version: 16 }
- run: npm ci
- run: npm run lint
- run: npx prettier --check .
tsc:
runs-on: ubuntu-latest
@ -33,3 +42,15 @@ jobs:
with: { node-version: 16 }
- run: npm ci
- run: npx tsc
release:
runs-on: ubuntu-latest
needs: [eslint, pack, prettier, tsc]
if: startsWith(github.ref, 'refs/tags/')
steps:
- uses: actions/setup-node@v2
with: { node-version: 16 }
- run: npm ci
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

View file

@ -5,8 +5,7 @@
"homepage": "https://monaco-yaml.js.org",
"scripts": {
"prepack": "node build.js",
"prepare": "husky install",
"lint": "eslint . && prettier --check ."
"prepare": "husky install"
},
"main": "./lib/esm/monaco.contribution.js",
"module": "./lib/esm/monaco.contribution.js",