Skip to content

Commit 65bebf3

Browse files
committed
Create release script
1 parent 19394cb commit 65bebf3

File tree

2 files changed

+52
-0
lines changed

2 files changed

+52
-0
lines changed
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
RELEASE_VERSION=$1
6+
VERSION_TYPE=$2
7+
8+
if [[ -z "$RELEASE_VERSION" || -z "$VERSION_TYPE" ]]; then
9+
echo "Error: Missing version number or version type."
10+
echo "Usage: npm run deploy -- <version> <major|minor|patch>"
11+
exit 1
12+
fi
13+
14+
git checkout master
15+
16+
echo "Pulling latest changes from master branch..."
17+
git pull
18+
19+
echo "Running lint checks..."
20+
npm run lint
21+
22+
echo "Running unit tests..."
23+
npm test
24+
25+
echo "Building project..."
26+
npm run build
27+
28+
git status --short
29+
30+
echo "Do you want to proceed with staging these files? (yes/no)"
31+
read CONFIRMATION
32+
33+
if [[ "$CONFIRMATION" == "yes" ]]; then
34+
echo "Staging changes..."
35+
git add .
36+
37+
git commit -m "Bundle release $RELEASE_VERSION"
38+
39+
echo "Bumping version..."
40+
npm version $VERSION_TYPE
41+
42+
echo "Publishing to npm..."
43+
npm publish --access public
44+
45+
echo "Pushing changes to repository..."
46+
git push --tags origin master
47+
48+
echo "Deployment complete!"
49+
else
50+
echo "Staging aborted. No changes committed. Deployment aborted."
51+
fi

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
"build": "rollup -c",
3737
"watch": "rollup -c --watch",
3838
"postbuild": "node bundle_size.js",
39+
"deploy": "bash deployment-scripts/deploy-release.sh",
3940
"lint": "eslint .",
4041
"precommit": "eslint . --max-warnings 0 && pretty-quick --staged",
4142
"test": "jest"

0 commit comments

Comments
 (0)