Skip to content

Commit f83fbc6

Browse files
Merge pull request #10 from suhaibbinyounis/feat/add-workflow-script
Feat: Add Workflow Automation Script
2 parents 8b25d2f + 7ec3c54 commit f83fbc6

2 files changed

Lines changed: 83 additions & 0 deletions

File tree

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
"pretest": "npm run compile-tests && npm run compile && npm run lint",
4747
"check-types": "tsc --noEmit",
4848
"lint": "eslint src",
49+
"workflow": "./workflow.sh",
4950
"test": "vscode-test"
5051
},
5152
"dependencies": {

workflow.sh

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
#!/bin/bash
2+
3+
# Workflow Automation Script
4+
# Usage: ./workflow.sh
5+
6+
echo "=========================================="
7+
echo " 🚀 Copilot API Gateway - Dev Workflow"
8+
echo "=========================================="
9+
echo ""
10+
echo "Select an action:"
11+
echo "1) 🌟 Start a New Feature"
12+
echo "2) 💾 Save & Push Changes"
13+
echo "3) 📦 Publish New Release (Main Only)"
14+
echo ""
15+
read -p "Enter choice [1-3]: " choice
16+
17+
case $choice in
18+
1)
19+
echo ""
20+
echo "--- Starting New Feature ---"
21+
echo "Switching to main and updating..."
22+
git checkout main
23+
git pull
24+
echo ""
25+
read -p "Enter feature name (e.g., dark-mode): " feature_name
26+
git checkout -b "feature/$feature_name"
27+
echo ""
28+
echo "✅ Created branch 'feature/$feature_name'. Happy coding!"
29+
;;
30+
2)
31+
echo ""
32+
echo "--- Saving & Pushing Changes ---"
33+
git add .
34+
echo "Staged all changes."
35+
read -p "Enter commit message: " commit_msg
36+
git commit -m "$commit_msg"
37+
current_branch=$(git branch --show-current)
38+
git push -u origin "$current_branch"
39+
echo ""
40+
echo "✅ Changes pushed to origin/$current_branch"
41+
echo "🔗 Go to GitHub to open a Pull Request."
42+
;;
43+
3)
44+
echo ""
45+
echo "--- Publishing New Release ---"
46+
current_branch=$(git branch --show-current)
47+
if [ "$current_branch" != "main" ]; then
48+
echo "❌ Error: You must be on 'main' to release. You are on '$current_branch'."
49+
exit 1
50+
fi
51+
52+
echo "Pulling latest changes..."
53+
git pull
54+
55+
echo ""
56+
echo "Select release type:"
57+
echo "1) Patch (0.0.X) - Bug fixes"
58+
echo "2) Minor (0.X.0) - New features"
59+
echo "3) Major (X.0.0) - Breaking changes"
60+
read -p "Enter choice [1-3]: " release_type_choice
61+
62+
case $release_type_choice in
63+
1) type="patch";;
64+
2) type="minor";;
65+
3) type="major";;
66+
*) echo "Invalid choice"; exit 1;;
67+
esac
68+
69+
echo "Bumping version ($type)..."
70+
npm version $type
71+
72+
echo "Pushing changes and tags..."
73+
git push --follow-tags
74+
75+
echo ""
76+
echo "✅ Release pushed! GitHub Actions will now publish to Marketplace."
77+
;;
78+
*)
79+
echo "Invalid choice."
80+
exit 1
81+
;;
82+
esac

0 commit comments

Comments
 (0)