From a15443f74a089c2d4c4a0e419abecba3c86ed2d8 Mon Sep 17 00:00:00 2001 From: Nicolas CARPi Date: Thu, 25 Nov 2021 22:34:10 +0100 Subject: [PATCH] add lint grunt command with github actions for linting and build/publish --- .github/workflows/linting.yml | 20 ++++++++++++++++++++ .github/workflows/publishing.yml | 24 ++++++++++++++++++++++++ Gruntfile.js | 5 ++++- 3 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/linting.yml create mode 100644 .github/workflows/publishing.yml diff --git a/.github/workflows/linting.yml b/.github/workflows/linting.yml new file mode 100644 index 000000000..7a74e5eee --- /dev/null +++ b/.github/workflows/linting.yml @@ -0,0 +1,20 @@ +name: lint +on: [push, pull_request] +jobs: + run-lint: + runs-on: ubuntu-latest + strategy: + matrix: + node: [ '14', '16' ] + name: Node ${{ matrix.node }} test + steps: + - uses: actions/checkout@v2 + - name: Setup node + uses: actions/setup-node@v2 + with: + node-version: ${{ matrix.node }} + cache: 'npm' + - name: Install dependencies + run: npm ci + - name: Run lint + run: grunt lint diff --git a/.github/workflows/publishing.yml b/.github/workflows/publishing.yml new file mode 100644 index 000000000..417b2854e --- /dev/null +++ b/.github/workflows/publishing.yml @@ -0,0 +1,24 @@ +name: publish +on: + release: + types: [created] +jobs: + publish: + runs-on: ubuntu-latest + name: Publish latest release + steps: + - uses: actions/checkout@v2 + - name: Setup node + uses: actions/setup-node@v2 + with: + node-version: '16.x' + cache: 'npm' + registry-url: 'https://registry.npmjs.org' + - name: Install dependencies + run: npm ci + - name: Build package + run: grunt build + - name: Publish package + run: npm publish + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/Gruntfile.js b/Gruntfile.js index 090c17d5e..a8389bc3e 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -288,5 +288,8 @@ module.exports = function (grunt) { grunt.registerTask('dist', ['build', 'compress', 'copy-docs']); // Default task. - grunt.registerTask('default', ['build-css', 'build-js']); + grunt.registerTask('default', 'build'); + + // Linting + grunt.registerTask('lint', 'eslint'); };