Skip to content
Merged
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
51 changes: 51 additions & 0 deletions deployment-scripts/deploy-release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#!/bin/bash

set -e

RELEASE_VERSION=$1
VERSION_TYPE=$2

if [[ -z "$RELEASE_VERSION" || -z "$VERSION_TYPE" ]]; then
echo "Error: Missing version number or version type."
echo "Usage: npm run deploy -- <version> <major|minor|patch>"
exit 1
fi

git checkout master

echo "Pulling latest changes from master branch..."
git pull

echo "Running lint checks..."
npm run lint

echo "Running unit tests..."
npm test

echo "Building project..."
npm run build

git status --short

echo "Do you want to proceed with staging these files? (yes/no)"
read CONFIRMATION

if [[ "$CONFIRMATION" == "yes" ]]; then
echo "Staging changes..."
git add .

git commit -m "Bundle release $RELEASE_VERSION"

echo "Bumping version..."
npm version $VERSION_TYPE

echo "Publishing to npm..."
npm publish --access public

echo "Pushing changes to repository..."
git push --tags origin master

echo "Deployment complete!"
else
echo "Staging aborted. No changes committed. Deployment aborted."
fi
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
"build": "rollup -c",
"watch": "rollup -c --watch",
"postbuild": "node bundle_size.js",
"deploy": "bash deployment-scripts/deploy-release.sh",
"lint": "eslint .",
"precommit": "eslint . --max-warnings 0 && pretty-quick --staged",
"test": "jest"
Expand Down