Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add CI job for npm publish #241

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions .github/workflows/npm.yml
Original file line number Diff line number Diff line change
@@ -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
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand All @@ -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": [
Expand Down