diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml new file mode 100644 index 0000000..265b3f6 --- /dev/null +++ b/.github/workflows/check.yml @@ -0,0 +1,50 @@ +name: Check + +on: + push: + branches: + - main + - 'renovate/**' + paths-ignore: + - '**.md' + - '.gitignore' + - 'assets/**' + - '.github/**' + - '!.github/workflows/check.yml' + + pull_request: + branches: + - main + paths-ignore: + - '**.md' + - '.gitignore' + - 'assets/**' + - '.github/**' + - '!.github/workflows/check.yml' + + workflow_dispatch: + workflow_call: + +jobs: + lint-and-test: + name: Lint & Test + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 + + - name: Setup Node.js + uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2 + with: + node-version: 18 + cache: npm + + - name: Install Dependencies + run: npm install + + - name: Lint + run: npm run lint + + - name: Test + run: npm run test diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml deleted file mode 100644 index 242b780..0000000 --- a/.github/workflows/main.yml +++ /dev/null @@ -1,58 +0,0 @@ -name: Test & Publish -on: [push, pull_request] - -jobs: - test: - runs-on: ubuntu-latest - strategy: - matrix: - node-version: [10.x, 12.x] - steps: - - name: Checkout 🛎️ - uses: actions/checkout@v2.3.3 - with: - persist-credentials: false - - - name: Setup 🔧 - uses: actions/setup-node@v2.1.2 - with: - node-version: ${{ matrix.node-version }} - - - name: Install ♻ - run: npm install - - - name: Lint 👓 - run: npm run lint - - - name: Test ✅ - run: npm run test - - publish: - needs: test - runs-on: ubuntu-latest - steps: - - name: Checkout 🛎️ - uses: actions/checkout@v2.3.3 - with: - persist-credentials: false - - - name: Check Version Changes ↗ - uses: EndBug/version-check@v1.6.0 - id: check - - - name: Setup 🔧 - if: steps.check.outputs.changed == 'true' - uses: actions/setup-node@v2.1.2 - with: - node-version: 12 - registry-url: https://registry.npmjs.org - - - name: Install ♻ - if: steps.check.outputs.changed == 'true' - run: npm install - - - name: Publish 🚀 - if: steps.check.outputs.changed == 'true' - run: npm publish - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} \ No newline at end of file diff --git a/package.json b/package.json index 6dd2fb0..1c3359d 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,7 @@ "lint": "eslint src/** test/**", "test": "jest test", "test:watch": "npm run test -- --watch", - "prepublishOnly": "npm run build" + "prepublishOnly": "npm run lint && npm run test && npm run build" }, "devDependencies": { "@rollup/plugin-node-resolve": "^11.0.0",