-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathreleash.sh
More file actions
executable file
·59 lines (50 loc) · 1.54 KB
/
releash.sh
File metadata and controls
executable file
·59 lines (50 loc) · 1.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/bin/bash
# Check if an argument is provided
if [ -z "$1" ]; then
echo "Error: VERSION argument is required."
echo "Usage: $0 <VERSION>"
exit 1
fi
# Assign the argument to the VERSION variable
VERSION=$1
echo "VERSION is set to: $VERSION"
# Check that VERSION matches the pattern x.x.x where x is a non-negative integer (allows 0)
if [[ ! "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "Error: VERSION must be in the format x.x.x where x is a non-negative integer (e.g., 0.1.2)"
exit 1
fi
# List of package.json paths
FILES=(
"./package.json"
)
# Update version in each package.json
for FILE in "${FILES[@]}"; do
if [ -f "$FILE" ]; then
jq --arg version "$VERSION" '.version = $version' "$FILE" > temp.json && mv temp.json "$FILE"
echo "Updated $FILE to version $VERSION"
else
echo "File not found: $FILE"
fi
done
# Remove generated files in dist while preserving dotfiles and key html files.
if [ -d "dist" ]; then
find "dist" -mindepth 1 -maxdepth 1 \
! -name ".*" \
! -name "index.html" \
! -name "login.html" \
-exec rm -rf {} +
echo "Cleaned generated contents in dist (kept index.html and login.html)"
fi
npm install
git commit -am "Release $VERSION"
git tag "v$VERSION"
echo "✅ All went well!"
echo "Step 1: Push to GitHub with:"
echo ""
echo "git push origin main && git push origin v$VERSION"
echo ""
echo "Step 2: Publish pacakge to npm with:"
echo "npm publish"
echo ""
echo "Step 3: Create a new release on GitHub with:"
echo "https://github.com/webgme/user-management-page/releases/new?tag=v$VERSION"