diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml new file mode 100644 index 0000000..9fdf61d --- /dev/null +++ b/.github/workflows/publish.yaml @@ -0,0 +1,24 @@ +name: Publish package to NPM + +on: + release: + types: [created] + +jobs: + build: + name: Publish + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - uses: actions/setup-node@v1 + with: + registry-url: 'https://registry.npmjs.org' + + - name: Build + run: make install build + + - name: Publish package to npm + run: npm publish . --access public + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml new file mode 100644 index 0000000..5adf0e1 --- /dev/null +++ b/.github/workflows/tests.yaml @@ -0,0 +1,31 @@ +name: Tests + +on: + push: + branches: + - master + pull_request: + +jobs: + tests: + name: Tests + runs-on: ubuntu-latest + steps: + ## https://github.com/actions/checkout + - name: Checkout + uses: actions/checkout@v2 + + # https://github.com/actions/setup-node + - name: Setup node + uses: actions/setup-node@v1 + + - name: Install dependencies + run: | + echo "::group::npm install" + npm install --color=always --no-progress + echo "::endgroup::" + + - name: Lint + run: | + echo "::group::Lint JS" + make lint@integration diff --git a/Makefile b/Makefile index 53f1a67..3053309 100644 --- a/Makefile +++ b/Makefile @@ -5,7 +5,7 @@ install: npm install -# Launch watch +# Launch watcher watch: npm run watch @@ -15,12 +15,11 @@ build: # Lint and code style fix lint: + npm run fix + +lint@integration: npm run lint -# Test +# Run tests test: build npm run test - -# Publish package -publish: build - npm publish . --access public diff --git a/package-lock.json b/package-lock.json index a2db5c3..3c3c6b5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "@elao/container.js", - "version": "3.0.0", + "version": "3.0.1", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 62aa17b..3dce005 100644 --- a/package.json +++ b/package.json @@ -28,6 +28,7 @@ "watch": "webpack --watch --mode=development", "build": "webpack --mode=production", "test": "jest", + "fix": "eslint src/* --ext .js,.json", "lint": "eslint src/* --ext .js,.json --fix" }, "devDependencies": {