diff --git a/.github/workflows/npm.yml b/.github/workflows/npm.yml new file mode 100644 index 0000000..b405625 --- /dev/null +++ b/.github/workflows/npm.yml @@ -0,0 +1,38 @@ +name: NPM Publish + +on: + push: + tags: + - "*.*.*" + +jobs: + publish: + runs-on: ubuntu-22.04 + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Set version variable + id: vars + run: | + APP_VERSION=${GITHUB_REF#refs/tags/} + echo "version: [$APP_VERSION]" + echo "{version}={$APP_VERSION}" >> $GITHUB_OUTPUT + + - name: Set version in package.json + uses: actions/setup-node@v3 + with: + node-version: "16.x" + registry-url: "https://registry.npmjs.org" + - run: yarn version --new-version $APP_VERSION --no-git-tag-version + env: + APP_VERSION: ${{ steps.vars.outputs.version }} + + - name: Publish + run: npm publish + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + +# vim:ft=yaml:et:ts=2:sw=2 diff --git a/package.json b/package.json index dd5cc7d..bc8f8ab 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,5 @@ { "name": "transliteration", - "version": "2.3.5", "description": "Unicode to ACSII transliteration / slugify module for node.js, browser, Web Worker, ReactNative and CLI.", "main": "dist/node/src/node/index.js", "module": "dist/browser/bundle.esm.min.js", @@ -23,7 +22,7 @@ "postbuild": "(ver && (echo export * from '../types';>> dist/node/src/node/index.d.ts)) || (echo \"export * from '../types';\">> dist/node/src/node/index.d.ts)", "coverage": "nyc npm test", "coveralls": "nyc npm test && nyc report -r=text-lcov | coveralls", - "prepublish": "npm run lint && npm test && npm run build" + "prepublishOnly": "yarn install && npm run lint && npm test && npm run build" }, "nyc": { "extension": [