-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy.sh
More file actions
executable file
·51 lines (41 loc) · 1.28 KB
/
Copy pathdeploy.sh
File metadata and controls
executable file
·51 lines (41 loc) · 1.28 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
#!/bin/bash
# Corox Deployment Script
echo "🚀 Starting Corox CLI Deployment (v1.2.0)..."
# 1. Build the project
echo "📦 Building project..."
npm run build
if [ $? -ne 0 ]; then
echo "❌ Build failed. Please fix TypeScript errors before deploying."
exit 1
fi
# 2. Git Push (to dev branch)
echo "☁️ Pushing to GitHub (dev)..."
git add .
git commit -m "chore: finalize release v1.2.0" || echo "Nothing to commit"
git push origin dev
if [ $? -ne 0 ]; then
echo "❌ Git push failed. Make sure you are authenticated."
exit 1
fi
# 3. NPM Publish
echo "📦 Publishing to NPM..."
# Load token from .env if it exists
if [ -f .env ]; then
# Extract NPM_TOKEN from .env file
NPM_TOKEN=$(grep NPM_TOKEN .env | cut -d '=' -f2 | tr -d '"' | tr -d "'")
fi
if [ -n "$NPM_TOKEN" ]; then
echo "Using token from .env for publishing..."
# Create temporary .npmrc for the publish command
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > .npmrc
npm publish --access public
rm -f .npmrc # Clean up immediately
else
echo "No NPM_TOKEN found in .env, attempting standard publish..."
npm publish --access public
fi
if [ $? -ne 0 ]; then
echo "❌ NPM publish failed. Check your token or permissions."
exit 1
fi
echo "✅ Deployment Successful! Corox v1.2.0 is now live on NPM."