|
| 1 | +# 🔐 Setup Vercel Secrets for Automated Deployment |
| 2 | + |
| 3 | +To enable automated deployment via GitHub Actions, you need to add Vercel credentials as GitHub secrets. |
| 4 | + |
| 5 | +--- |
| 6 | + |
| 7 | +## 📋 **What You Need** |
| 8 | + |
| 9 | +Three secrets are required: |
| 10 | +1. **VERCEL_TOKEN** - Your Vercel authentication token |
| 11 | +2. **VERCEL_ORG_ID** - Your Vercel organization ID |
| 12 | +3. **VERCEL_PROJECT_ID** - Your Vercel project ID |
| 13 | + |
| 14 | +--- |
| 15 | + |
| 16 | +## 🚀 **STEP-BY-STEP GUIDE** |
| 17 | + |
| 18 | +### **Step 1: Get Your Vercel Token** |
| 19 | + |
| 20 | +1. **Go to Vercel Tokens page**: |
| 21 | + 👉 https://vercel.com/account/tokens |
| 22 | + |
| 23 | +2. **Create a new token**: |
| 24 | + - Click **"Create Token"** |
| 25 | + - Name: `GitHub Actions` (or any name you prefer) |
| 26 | + - Scope: **Full Account** |
| 27 | + - Expiration: **No Expiration** (or set your preference) |
| 28 | + |
| 29 | +3. **Copy the token**: |
| 30 | + - Click **"Create"** |
| 31 | + - **IMPORTANT**: Copy the token immediately |
| 32 | + - You won't be able to see it again! |
| 33 | + - Save it somewhere temporarily |
| 34 | + |
| 35 | +**Example token**: `vercel_abc123def456ghi789...` |
| 36 | + |
| 37 | +--- |
| 38 | + |
| 39 | +### **Step 2: Get Your Vercel Org ID and Project ID** |
| 40 | + |
| 41 | +#### **Option A: Link Project First (Recommended)** |
| 42 | + |
| 43 | +```bash |
| 44 | +# Install Vercel CLI |
| 45 | +npm install -g vercel |
| 46 | + |
| 47 | +# Clone your repository (if not already) |
| 48 | +git clone https://github.com/christophernemala/tutorialkit.git |
| 49 | +cd tutorialkit |
| 50 | + |
| 51 | +# Login to Vercel |
| 52 | +vercel login |
| 53 | + |
| 54 | +# Link the project |
| 55 | +vercel link |
| 56 | +``` |
| 57 | + |
| 58 | +**Follow the prompts**: |
| 59 | +- Set up and deploy? → **Yes** |
| 60 | +- Which scope? → Select your account |
| 61 | +- Link to existing project? → **No** |
| 62 | +- Project name? → `tutorialkit` (or your choice) |
| 63 | +- Directory? → `./` (press Enter) |
| 64 | + |
| 65 | +**Get the IDs**: |
| 66 | +```bash |
| 67 | +# View the project configuration |
| 68 | +cat .vercel/project.json |
| 69 | +``` |
| 70 | + |
| 71 | +**You'll see**: |
| 72 | +```json |
| 73 | +{ |
| 74 | + "orgId": "team_xxxxxxxxxxxxx", |
| 75 | + "projectId": "prj_xxxxxxxxxxxxx" |
| 76 | +} |
| 77 | +``` |
| 78 | + |
| 79 | +**Copy these values**: |
| 80 | +- `orgId` → This is your **VERCEL_ORG_ID** |
| 81 | +- `projectId` → This is your **VERCEL_PROJECT_ID** |
| 82 | + |
| 83 | +--- |
| 84 | + |
| 85 | +#### **Option B: Deploy First, Then Get IDs** |
| 86 | + |
| 87 | +1. **Deploy to Vercel**: |
| 88 | + 👉 https://vercel.com/new/clone?repository-url=https://github.com/christophernemala/tutorialkit |
| 89 | + |
| 90 | +2. **After deployment, go to project settings**: |
| 91 | + - Go to your Vercel dashboard |
| 92 | + - Click on your project |
| 93 | + - Go to **Settings** → **General** |
| 94 | + |
| 95 | +3. **Find the IDs**: |
| 96 | + - **Project ID**: In the URL or settings page |
| 97 | + - **Org ID**: In your account settings |
| 98 | + |
| 99 | +--- |
| 100 | + |
| 101 | +### **Step 3: Add Secrets to GitHub** |
| 102 | + |
| 103 | +1. **Go to your repository secrets page**: |
| 104 | + 👉 https://github.com/christophernemala/tutorialkit/settings/secrets/actions |
| 105 | + |
| 106 | +2. **Add the first secret**: |
| 107 | + - Click **"New repository secret"** |
| 108 | + - Name: `VERCEL_TOKEN` |
| 109 | + - Value: Paste your Vercel token from Step 1 |
| 110 | + - Click **"Add secret"** |
| 111 | + |
| 112 | +3. **Add the second secret**: |
| 113 | + - Click **"New repository secret"** |
| 114 | + - Name: `VERCEL_ORG_ID` |
| 115 | + - Value: Paste your org ID from Step 2 |
| 116 | + - Click **"Add secret"** |
| 117 | + |
| 118 | +4. **Add the third secret**: |
| 119 | + - Click **"New repository secret"** |
| 120 | + - Name: `VERCEL_PROJECT_ID` |
| 121 | + - Value: Paste your project ID from Step 2 |
| 122 | + - Click **"Add secret"** |
| 123 | + |
| 124 | +--- |
| 125 | + |
| 126 | +## ✅ **Verify Your Secrets** |
| 127 | + |
| 128 | +After adding all three secrets, you should see: |
| 129 | + |
| 130 | +``` |
| 131 | +Repository secrets (3) |
| 132 | +
|
| 133 | +VERCEL_TOKEN Updated X minutes ago |
| 134 | +VERCEL_ORG_ID Updated X minutes ago |
| 135 | +VERCEL_PROJECT_ID Updated X minutes ago |
| 136 | +``` |
| 137 | + |
| 138 | +**Note**: You can't view the secret values after adding them (for security). |
| 139 | + |
| 140 | +--- |
| 141 | + |
| 142 | +## 🎯 **Test Automated Deployment** |
| 143 | + |
| 144 | +Once secrets are added, test the deployment: |
| 145 | + |
| 146 | +```bash |
| 147 | +# Make a small change |
| 148 | +echo "# Test deployment" >> README.md |
| 149 | + |
| 150 | +# Commit and push |
| 151 | +git add . |
| 152 | +git commit -m "test: trigger automated deployment" |
| 153 | +git push origin main |
| 154 | +``` |
| 155 | + |
| 156 | +**What happens**: |
| 157 | +1. GitHub Actions workflow triggers |
| 158 | +2. Uses your secrets to authenticate with Vercel |
| 159 | +3. Builds your project |
| 160 | +4. Deploys to Vercel automatically |
| 161 | +5. You get a deployment URL! |
| 162 | + |
| 163 | +**Check progress**: |
| 164 | +👉 https://github.com/christophernemala/tutorialkit/actions |
| 165 | + |
| 166 | +--- |
| 167 | + |
| 168 | +## 🔧 **Troubleshooting** |
| 169 | + |
| 170 | +### **Error: "VERCEL_TOKEN is not set"** |
| 171 | + |
| 172 | +**Solution**: Make sure you added the secret with the exact name `VERCEL_TOKEN` (case-sensitive) |
| 173 | + |
| 174 | +--- |
| 175 | + |
| 176 | +### **Error: "Invalid token"** |
| 177 | + |
| 178 | +**Solution**: |
| 179 | +1. Token might have expired |
| 180 | +2. Create a new token: https://vercel.com/account/tokens |
| 181 | +3. Update the GitHub secret with the new token |
| 182 | + |
| 183 | +--- |
| 184 | + |
| 185 | +### **Error: "Project not found"** |
| 186 | + |
| 187 | +**Solution**: |
| 188 | +1. Verify `VERCEL_PROJECT_ID` is correct |
| 189 | +2. Make sure you linked/deployed the project first |
| 190 | +3. Check the project exists in your Vercel dashboard |
| 191 | + |
| 192 | +--- |
| 193 | + |
| 194 | +### **Error: "Unauthorized"** |
| 195 | + |
| 196 | +**Solution**: |
| 197 | +1. Verify `VERCEL_ORG_ID` is correct |
| 198 | +2. Make sure the token has correct permissions |
| 199 | +3. Token scope should be "Full Account" |
| 200 | + |
| 201 | +--- |
| 202 | + |
| 203 | +## 📊 **Complete Configuration Checklist** |
| 204 | + |
| 205 | +- [ ] Vercel account created |
| 206 | +- [ ] Vercel token generated |
| 207 | +- [ ] Project linked or deployed to Vercel |
| 208 | +- [ ] Org ID obtained |
| 209 | +- [ ] Project ID obtained |
| 210 | +- [ ] `VERCEL_TOKEN` added to GitHub secrets |
| 211 | +- [ ] `VERCEL_ORG_ID` added to GitHub secrets |
| 212 | +- [ ] `VERCEL_PROJECT_ID` added to GitHub secrets |
| 213 | +- [ ] Test deployment triggered |
| 214 | +- [ ] Deployment successful |
| 215 | + |
| 216 | +--- |
| 217 | + |
| 218 | +## 🎉 **What You Get After Setup** |
| 219 | + |
| 220 | +Once configured, every time you push to `main`: |
| 221 | + |
| 222 | +1. ✅ **Automatic build** - GitHub Actions builds your project |
| 223 | +2. ✅ **Automatic deployment** - Deploys to Vercel |
| 224 | +3. ✅ **Live URL** - Get production URL instantly |
| 225 | +4. ✅ **Zero manual work** - Just push code! |
| 226 | + |
| 227 | +**Example workflow**: |
| 228 | +```bash |
| 229 | +# Edit your tutorial |
| 230 | +vim docs/tutorialkit.dev/src/content/tutorial/my-lesson/content.md |
| 231 | + |
| 232 | +# Commit and push |
| 233 | +git add . |
| 234 | +git commit -m "feat: add new lesson" |
| 235 | +git push origin main |
| 236 | + |
| 237 | +# Wait 5-10 minutes |
| 238 | +# Your changes are LIVE automatically! |
| 239 | +``` |
| 240 | + |
| 241 | +--- |
| 242 | + |
| 243 | +## 🔗 **Quick Links** |
| 244 | + |
| 245 | +- **Create Vercel Token**: https://vercel.com/account/tokens |
| 246 | +- **GitHub Secrets**: https://github.com/christophernemala/tutorialkit/settings/secrets/actions |
| 247 | +- **Vercel Dashboard**: https://vercel.com/dashboard |
| 248 | +- **GitHub Actions**: https://github.com/christophernemala/tutorialkit/actions |
| 249 | + |
| 250 | +--- |
| 251 | + |
| 252 | +## 💡 **Alternative: Manual Deployment** |
| 253 | + |
| 254 | +If you don't want to set up secrets, you can still deploy manually: |
| 255 | + |
| 256 | +### **Option 1: One-Click Deploy** |
| 257 | +👉 https://vercel.com/new/clone?repository-url=https://github.com/christophernemala/tutorialkit |
| 258 | + |
| 259 | +### **Option 2: CLI Deploy** |
| 260 | +```bash |
| 261 | +npm install -g vercel |
| 262 | +cd tutorialkit |
| 263 | +vercel --prod |
| 264 | +``` |
| 265 | + |
| 266 | +**No secrets needed for manual deployment!** |
| 267 | + |
| 268 | +--- |
| 269 | + |
| 270 | +## 📝 **Summary** |
| 271 | + |
| 272 | +**To enable automated deployment**: |
| 273 | + |
| 274 | +1. Get Vercel token: https://vercel.com/account/tokens |
| 275 | +2. Link project: `vercel link` |
| 276 | +3. Get IDs from `.vercel/project.json` |
| 277 | +4. Add 3 secrets to GitHub: https://github.com/christophernemala/tutorialkit/settings/secrets/actions |
| 278 | +5. Push code → Auto-deploy! 🚀 |
| 279 | + |
| 280 | +**Secrets needed**: |
| 281 | +``` |
| 282 | +VERCEL_TOKEN = [your token from vercel.com/account/tokens] |
| 283 | +VERCEL_ORG_ID = [from .vercel/project.json] |
| 284 | +VERCEL_PROJECT_ID = [from .vercel/project.json] |
| 285 | +``` |
| 286 | + |
| 287 | +--- |
| 288 | + |
| 289 | +**Need help?** Check the troubleshooting section above or open an issue! |
| 290 | + |
| 291 | +**Ready to deploy?** Follow the steps above! 🎉 |
0 commit comments