diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml new file mode 100644 index 0000000..6ab856f --- /dev/null +++ b/.github/workflows/cd.yml @@ -0,0 +1,44 @@ +name: CD - Publish to npm + +on: + push: + branches: [ master ] + +jobs: + build: + name: Publish Build + runs-on: ubuntu-latest + + steps: + - name: Checkout 🛎️ + uses: actions/checkout@v2 + + - name: Setup Node.js 16 + uses: actions/setup-node@v1 + with: + node-version: 16 + + - name: Use CI Cache + uses: actions/cache@v2 + with: + path: ~/.npm + key: ${{ runner.os }}-node16-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-node16- + + - name: Install 🔧 + run: npm install + + - name: Build 🏗️ + run: npm run build + + - name: Publish 📡 + id: publish + if: github.event_name == 'pull_request' && github.ref == 'refs/heads/master' + uses: JS-DevTools/npm-publish@v1 + with: + token: ${{ secrets.NPM_TOKEN }} + + - if: steps.publish.outputs.type != 'none' + run: | + echo "Version changed: ${{ steps.publish.outputs.old-version }} => ${{ steps.publish.outputs.version }}" \ No newline at end of file diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..9286038 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,33 @@ +name: CI - Lint + Tests + Build + +on: + push: + branches: [ dev ] + + pull_request: + branches: [ master ] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout 🛎️ + uses: actions/checkout@v2 + + - name: Setup NodeJS 16 + uses: actions/setup-node@v1 + with: + node-version: 16 + + - name: Install 🔧 + run: npm install + + - name: Lint 🧐 + run: npm run lint + + - name: Test 🚨 + run: npm test + + - name: Build 🏗️ + run: npm run build \ No newline at end of file diff --git a/.npmrc b/.npmrc new file mode 100644 index 0000000..4fd0219 --- /dev/null +++ b/.npmrc @@ -0,0 +1 @@ +engine-strict=true \ No newline at end of file diff --git a/package.json b/package.json index 081dc94..fc8a3d4 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,7 @@ "lint": "eslint \"**\\*.ts\"", "lintFix": "eslint \"**\\*.ts\" --fix" }, - "author": "Karel Krýda", + "author": "Karel Krýda (https://github.com/karelkryda)", "license": "GPL-3.0", "types": "dist/index.d.ts", "files": [ @@ -63,5 +63,8 @@ "nyc": "^15.1.0", "ts-mocha": "^8.0.0", "typescript": "^4.5.3" + }, + "engines": { + "node": ">=12.0.0" } }