Skip to content

Commit ce0bf08

Browse files
2 parents 97e236d + d3239d7 commit ce0bf08

File tree

7 files changed

+150
-8
lines changed

7 files changed

+150
-8
lines changed

.github/workflows/test-and-build.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Test Suite
2+
3+
on:
4+
pull_request:
5+
branches: [master]
6+
7+
jobs:
8+
test-and-build:
9+
runs-on: ubuntu-latest
10+
strategy:
11+
matrix:
12+
node-version: [16.x]
13+
steps:
14+
- name: Checkout code
15+
uses: actions/checkout@v2
16+
with:
17+
ref: ${{ github.event.pull_request.head.sha }}
18+
fetch-depth: 0
19+
20+
- name: Use Node.js ${{ matrix.node-version }}
21+
uses: actions/setup-node@v2
22+
with:
23+
node-version: ${{ matrix.node-version }}
24+
25+
- name: Install dependencies
26+
run: npm install
27+
28+
- name: Linting
29+
run: npm run eslint
30+
31+
- name: Run tests
32+
run: npm run test
33+
34+
- name: Build
35+
run: npm run build
Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
name: Deploy
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
ReleaseType:
7+
description: 'Release Type'
8+
required: true
9+
default: 'warning'
10+
type: choice
11+
options:
12+
- Major
13+
- Feature
14+
- Bug
15+
16+
jobs:
17+
update-and-publish:
18+
runs-on: ubuntu-latest
19+
steps:
20+
- name: Checkout code
21+
uses: actions/checkout@v2
22+
23+
- name: Setup Node.js
24+
uses: actions/setup-node@v2
25+
with:
26+
node-version: 16.x
27+
scope: '@keyvaluesystems'
28+
29+
- name: Install dependencies
30+
run: npm ci
31+
32+
- name: Run tests
33+
run: npm run test
34+
35+
- name: 'Set release type : ${{ inputs.ReleaseType }}'
36+
id: release_type
37+
uses: ASzc/change-string-case-action@v5
38+
with:
39+
string: ${{ inputs.ReleaseType }}
40+
41+
- name: Extract Current Branch and Validate
42+
id: get_current_branch
43+
shell: bash
44+
run: |
45+
BRANCH="${GITHUB_REF#refs/heads/}"
46+
if [ "$BRANCH" == 'master' ]
47+
then
48+
echo "Branch validation Successful"
49+
else
50+
echo "Releases only taken from master branch"
51+
exit 1
52+
fi
53+
54+
- name: Get Latest version from package.json
55+
run: |
56+
# Get the latest version from package.json
57+
LATEST_VERSION=$(node -p "require('./package.json').version")
58+
59+
# Output the latest version as a workflow env
60+
echo "latest_version=$LATEST_VERSION" >> $GITHUB_ENV
61+
62+
- name: Get new version
63+
id: get_next_version
64+
uses: christian-draeger/[email protected]
65+
with:
66+
current-version: ${{ env.latest_version }}
67+
version-fragment: ${{ steps.release_type.outputs.lowercase }}
68+
69+
- name: Update version in package.json and package-lock.json
70+
run: |
71+
OLD_VERSION=${{ env.latest_version }}
72+
NEW_VERSION=${{ steps.get_next_version.outputs.next-version }}
73+
74+
npm version $NEW_VERSION --no-git-tag-version
75+
git config user.name github-actions
76+
git config user.email [email protected]
77+
git add package.json package-lock.json
78+
git commit -m "Bump version from $OLD_VERSION to $NEW_VERSION"
79+
git push origin HEAD:master
80+
81+
- name: Build Package
82+
run: npm run build
83+
84+
- name: Publish package
85+
run: npm publish --access public --//registry.npmjs.org/:_authToken=${{ secrets.NPM_AUTH_TOKEN }}
86+
if: success()
87+
88+
- name: Revert package.json and package-lock.json
89+
run: |
90+
# Revert package.json and package-lock.json to the previous version
91+
npm version ${{ env.latest_version }} --no-git-tag-version
92+
git commit -am "Revert to version ${{ env.latest_version }}"
93+
git push origin HEAD:master
94+
if: failure()
95+
96+
- name: Create GitHub release
97+
if: success()
98+
uses: actions/create-release@v1
99+
env:
100+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
101+
with:
102+
tag_name: v${{ steps.get_next_version.outputs.next-version }}
103+
release_name: Release v${{ steps.get_next_version.outputs.next-version }}
104+
# body: Release ${{ env.NEW_VERSION }}
105+
draft: false
106+
prerelease: false

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
/build
99
/dist
1010
.rpt2_cache
11+
/coverage
1112

1213
# misc
1314
.DS_Store

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11

22
# React Scatter graph
3-
<a href="https://www.npmjs.com/package/react-vertical-stepper"><img src="https://badgen.net/npm/v/react-vertical-stepper?color=blue" alt="npm version"></a> <a href="https://www.npmjs.com/package/react-vertical-stepper" ><img src="https://img.shields.io/npm/dw/react-vertical-stepper?label=Downloads" /></a> <a href="https://github.com/KeyValueSoftwareSystems/react-vertical-stepper"><img src="https://github.com/KeyValueSoftwareSystems/react-vertical-stepper/actions/workflows/update-and-publish.yml/badge.svg" alt="" /></a>
3+
<a href="https://www.npmjs.com/package/@keyvaluesystems/react-scatter-graph"><img src="https://badgen.net/npm/v/@keyvaluesystems/react-scatter-graph?color=blue" alt="npm version"></a> <a href="https://www.npmjs.com/package/@keyvaluesystems/react-scatter-graph" ><img src="https://img.shields.io/npm/dw/@keyvaluesystems/react-scatter-graph?label=Downloads" /></a> <a href="https://github.com/KeyValueSoftwareSystems/@keyvaluesystems/react-scatter-graph"><img src="https://github.com/KeyValueSoftwareSystems/@keyvaluesystems/react-scatter-graph/actions/workflows/update-and-publish.yml/badge.svg" alt="" /></a>
44

55
<div align="center">
6-
<img src="./src/assets/vertical-stepper-example.png" alt="" width="269" height="416"/>
6+
<img src="./assets/react-scatter-graph-example-2.png" alt="" width="700"/>
77
</div>
88

99
A fully customizable ready to use scatter graph UI package for React.
84.7 KB
Loading

package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"name": "react-scatter-graph",
3-
"version": "0.0.1",
2+
"name": "@keyvaluesystems/react-scatter-graph",
3+
"version": "0.0.2",
44
"description": "A fully customizable react scatter graph",
55
"main": "./build/index.js",
66
"source": "src/index.tsx",

0 commit comments

Comments
 (0)