Skip to content

Commit

Permalink
Merge pull request #69 from LCMApps/add-github-action-for-npm-releases
Browse files Browse the repository at this point in the history
Add GitHub action for NPM releases
  • Loading branch information
oleh-poberezhets committed Jan 23, 2020
2 parents c4ff052 + 9b3856f commit 8cf2124
Show file tree
Hide file tree
Showing 6 changed files with 188 additions and 115 deletions.
54 changes: 54 additions & 0 deletions .github/workflows/npm_publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: NPM Release

on:
release:
types: [published, edited]

jobs:
check:
name: Check version and tag
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Get package version
shell: bash
id: package_version
run: |
ver=$(jq .version package.json | sed -e "s/^\"//" -e "s/\"//")
echo "::set-output name=version::$ver"
- name: Compare package version and release tag
if: steps.package_version.outputs.version != github.event.release.tag_name
env:
TAG: "${{ github.event.release.tag_name }}"
PKG_VER: ${{ steps.package_version.outputs.version }}
run: |
echo "Mismatch NPM version $PKG_VER and git tag $TAG"
exit 1
build:
name: Lint and test
needs: check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/setup-node@v1
with:
node-version: 12
- run: yarn install --frozen-lock-file
- run: yarn lint
- run: yarn tests

publish-npm:
name: Publish to NPM
needs: [check, build]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions/setup-node@v1
with:
node-version: 12
registry-url: https://registry.npmjs.org/
- run: yarn install --frozen-lock-file
- run: yarn publish
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
node_modules
npm-debug.log
.idea
coverage
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

### 2.0.3

- Dependencies was bumped

### 2.0.2

BUG FIXES:
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# consul-kv-monitor

[![NPM version](https://img.shields.io/npm/v/consul-kv-monitor.svg)](https://www.npmjs.com/package/consul-kv-monitor)
[![Release Status](https://github.com/LCMApps/consul-kv-monitor/workflows/NPM%20Release/badge.svg)](https://github.com/LCMApps/consul-kv-monitor/releases)
[![Build Status](https://travis-ci.org/LCMApps/consul-kv-monitor.svg?branch=master)](https://travis-ci.org/LCMApps/consul-kv-monitor)
[![Coverage Status](https://coveralls.io/repos/github/LCMApps/consul-kv-monitor/badge.svg?branch=master)](https://coveralls.io/github/LCMApps/consul-kv-monitor?branch=master)

Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "consul-kv-monitor",
"version": "2.0.2",
"version": "2.0.3",
"description": "Service to monitor key-value records in consul",
"main": "index.js",
"directories": {
Expand All @@ -11,7 +11,7 @@
"tests": "yarn run unit-tests && yarn run func-tests",
"test:coverage": "NODE_ENV=test istanbul cover _mocha --print both -- --opts tests/mocha.opts -R spec ./tests",
"unit-tests": "NODE_ENV=test mocha --opts tests/mocha.opts -R spec './tests/Unit/**/*.js'",
"func-tests": "NODE_ENV=test mocha --opts tests/mocha.opts --timeout 30000 -R spec './tests/Functional/**/*.js'",
"func-tests": "NODE_ENV=test mocha --opts tests/mocha.opts --timeout 3000 -R spec './tests/Functional/**/*.js'",
"coveralls": "NODE_ENV=test istanbul cover ./node_modules/mocha/bin/_mocha --report lcovonly -- --opts tests/mocha.opts -R spec ./tests && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js && rm -rf ./coverage"
},
"repository": {
Expand Down
Loading

0 comments on commit 8cf2124

Please sign in to comment.