-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.sh
More file actions
executable file
·108 lines (95 loc) · 3.14 KB
/
Copy pathsetup.sh
File metadata and controls
executable file
·108 lines (95 loc) · 3.14 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
#!/bin/bash
set -e
echo "🚀 Devscope Action Setup"
echo "========================"
echo ""
# Check if we're in the right directory
if [ ! -f "action.yml" ]; then
echo "❌ Error: action.yml not found"
echo "Please run this script from the devscope-action directory"
exit 1
fi
# Check if git is initialized
if [ ! -d ".git" ]; then
echo "📦 Initializing git repository..."
git init
git add .
git commit -m "Initial commit: Devscope GitHub Action v1.0.0"
echo "✅ Git initialized"
else
echo "✅ Git already initialized"
fi
# Check if remote is set
if ! git remote get-url origin &> /dev/null; then
echo ""
echo "🔗 Setting up remote..."
echo "Enter your GitHub username:"
read -r GITHUB_USER
REPO_URL="https://github.com/$GITHUB_USER/devscope-action.git"
git remote add origin "$REPO_URL"
echo "✅ Remote added: $REPO_URL"
else
echo "✅ Remote already configured: $(git remote get-url origin)"
fi
# Offer to create GitHub repo
echo ""
echo "📋 Next steps:"
echo ""
echo "1. Create GitHub repository:"
echo " gh repo create devscope-action --public --source=. --remote=origin"
echo ""
echo "2. Push code:"
echo " git push -u origin main"
echo ""
echo "3. Create v1 release:"
echo " git tag -a v1.0.0 -m 'Release v1.0.0'"
echo " git tag -a v1 -m 'Latest v1.x.x'"
echo " git push origin v1.0.0 v1"
echo ""
echo "4. Publish to GitHub Marketplace:"
echo " - Go to: https://github.com/$USER/devscope-action/releases/new"
echo " - Choose tag: v1.0.0"
echo " - Check: ☑ Publish this Action to the GitHub Marketplace"
echo " - Fill in details and publish"
echo ""
# Offer to run setup automatically
echo "Would you like to run these steps automatically? (y/n)"
read -r ANSWER
if [ "$ANSWER" == "y" ]; then
echo ""
echo "🔨 Running setup..."
# Check if gh CLI is installed
if ! command -v gh &> /dev/null; then
echo "❌ GitHub CLI (gh) not found"
echo "Install it: https://cli.github.com/"
exit 1
fi
# Create repo
echo "📦 Creating GitHub repository..."
if gh repo create devscope-action --public --source=. --remote=origin --push; then
echo "✅ Repository created and pushed"
else
echo "⚠️ Repository might already exist, continuing..."
fi
# Create tags
echo "🏷️ Creating version tags..."
git tag -a v1.0.0 -m "Release v1.0.0 - Initial public release" || echo "Tag v1.0.0 exists"
git tag -fa v1 -m "Latest v1.x.x release" || echo "Tag v1 exists"
git push origin v1.0.0 v1 --force
echo ""
echo "✅ Setup complete!"
echo ""
echo "📝 Final step: Publish to Marketplace"
echo " Visit: https://github.com/$(gh repo view --json nameWithOwner -q .nameWithOwner)/releases/new"
echo " 1. Select tag: v1.0.0"
echo " 2. Check: ☑ Publish this Action to the GitHub Marketplace"
echo " 3. Category: Continuous Integration"
echo " 4. Create release"
echo ""
else
echo ""
echo "✅ Setup instructions displayed above"
echo "Run the commands manually when ready"
fi
echo ""
echo "🎉 All done! Your action is ready to use."