diff --git a/.github/workflows/npmpublish.yml b/.github/workflows/npmpublish.yml new file mode 100644 index 0000000..e7cae6d --- /dev/null +++ b/.github/workflows/npmpublish.yml @@ -0,0 +1,30 @@ +name: Node.js Package + +on: + release: + types: [created] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - name: Install nodejs dependencies + run: sudo apt-get install gpg dirmngr + + - name: Install nodejs + uses: asdf-vm/actions/install@v1.0.0 + with: + before_install: bash ~/.asdf/plugins/nodejs/bin/import-release-team-keyring + + - name: Install dependencies + run: yarn install + + - name: Publish the package to npmjs + run: | + npm config set //registry.npmjs.org/:_authToken=$NODE_AUTH_TOKEN + npm config set scope "@kollegorna" + npm publish --access public + env: + NODE_AUTH_TOKEN: ${{secrets.NPM_AUTH_TOKEN}} diff --git a/.tool-versions b/.tool-versions new file mode 100644 index 0000000..b1d3983 --- /dev/null +++ b/.tool-versions @@ -0,0 +1 @@ +nodejs 12.9.0 diff --git a/README.md b/README.md index 2eb0d1c..7638961 100644 --- a/README.md +++ b/README.md @@ -2,19 +2,18 @@ A vanilla JS replacement for (Rails) [Cocoon](https://github.com/nathanvda/cocoon)'s jQuery script - ## Usage Replace `` with the corresponding values: ``` -yarn add git+https://github.com/kollegorna/cocoon-vanilla-js.git# +yarn add @kollegorna/cocoon-vanilla-js ``` Import as ES6 module: ```js -import 'cocoon-vanilla-js' +import "cocoon-vanilla-js"; ``` ## Notes diff --git a/package.json b/package.json index c194e66..4913010 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "cocoon-vanilla-js", + "name": "@kollegorna/cocoon-vanilla-js", "version": "1.0.2", "description": "A vanilla JS replacement for (Rails) Cocoon's jQuery script", "main": "index.js",