Skip to content

Commit c5b6235

Browse files
ticked the version, updated changelog, added auto publish, changelog check, and version check
1 parent 056b4b4 commit c5b6235

File tree

6 files changed

+108
-3
lines changed

6 files changed

+108
-3
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Changelog updated
2+
3+
on: pull_request
4+
5+
jobs:
6+
check-changelog:
7+
runs-on: ubuntu-latest
8+
9+
steps:
10+
- name: Checkout repository
11+
uses: actions/checkout@v4
12+
13+
- name: Fetch master branch
14+
run: |
15+
git fetch origin master:master
16+
17+
- name: Check that changelog is updated
18+
run: |
19+
if ! git diff --name-only master | grep -q '^CHANGELOG.md$'; then
20+
echo "Error: CHANGELOG.md has not been updated."
21+
exit 1
22+
fi

.github/workflows/npm-publish.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: "Auto-publish NPM Package"
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
8+
jobs:
9+
push_to_registry:
10+
name: "Setup, and publish"
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: "Check out the repo"
15+
uses: actions/checkout@v4
16+
17+
- name: "Set up Node"
18+
uses: actions/setup-node@v4
19+
with:
20+
registry-url: "https://registry.npmjs.org"
21+
node-version: 20
22+
check-latest: true
23+
24+
- name: "Dependencies and tests"
25+
run: |
26+
npm ci
27+
npm run build
28+
- name: "Publish to NPM"
29+
uses: JS-DevTools/npm-publish@v3
30+
with:
31+
token: ${{ secrets.NPM_TOKEN }}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: "NPM Version Check"
2+
3+
on: pull_request
4+
5+
jobs:
6+
push_to_registry:
7+
name: "NPM Version Check"
8+
runs-on: ubuntu-latest
9+
10+
steps:
11+
- name: "Check out the repo"
12+
uses: actions/checkout@v4
13+
14+
- name: "Set up Node"
15+
uses: actions/setup-node@v4
16+
with:
17+
registry-url: "https://registry.npmjs.org"
18+
node-version: "lts/*"
19+
check-latest: true
20+
21+
- name: "Check if version is published"
22+
run: |
23+
PACKAGE_VERSION=$(npm pkg get version --workspaces=false | tr -d \")
24+
PACKAGE_NAME=$(npm pkg get name --workspaces=false | tr -d \")
25+
# Run npm view and capture the exit code (success or failure)
26+
npm view "$PACKAGE_NAME@$PACKAGE_VERSION" --json > result.json 2>&1 || true
27+
# Check the exit code to determine if the version exists
28+
if grep -q "is not in this registry." result.json; then
29+
echo "Version $PACKAGE_VERSION does not exist for $PACKAGE_NAME on npmjs.com. 🎉"
30+
exit 0
31+
else
32+
echo "Version $PACKAGE_VERSION already exists for $PACKAGE_NAME on npmjs.com. 😬🫠"
33+
echo "Please update the 'version' property in package.json and try again."
34+
exit 1
35+
fi

CHANGELOG.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,23 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1313

1414
### Fixed
1515

16+
## [1.1.5]
17+
18+
### Added
19+
20+
- Auto publishing of the npm package
21+
-
22+
23+
### Changed
24+
25+
- Running package audits more frequently
26+
- Split up github workflows
27+
- Converted from jest to vitest
28+
29+
### Fixed
30+
31+
- Updated packages with vulnerabilities
32+
1633
## [1.1.4] - 2024-10-18
1734

1835
### Fixed

package-lock.json

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

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@mxenabled/react-native-widget-sdk",
33
"description": "MX React Native Widget SDK",
4-
"version": "1.1.4",
4+
"version": "1.1.5",
55
"main": "dist/src/index.js",
66
"source": "src/index.ts",
77
"license": "MIT",

0 commit comments

Comments
 (0)