From d1c499b2241310fdd5a6b29957c504fea9392fda Mon Sep 17 00:00:00 2001 From: Remco Haszing Date: Mon, 23 Aug 2021 17:15:07 +0200 Subject: [PATCH] Automate publishing to npm Also the `lint` job has been split into `eslint` and `prettier`. Closes #6 --- .github/workflows/ci.yaml | 25 +++++++++++++++++++++++-- package.json | 3 +-- 2 files changed, 24 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 808d0b2..f324afc 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -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 }} diff --git a/package.json b/package.json index 1d9647d..6df8b60 100644 --- a/package.json +++ b/package.json @@ -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",