Skip to content

Commit

Permalink
Create release script
Browse files Browse the repository at this point in the history
  • Loading branch information
clarissedmn committed Feb 13, 2025
1 parent 19394cb commit 65bebf3
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 0 deletions.
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

0 comments on commit 65bebf3

Please sign in to comment.