79 lines
2.8 KiB
Markdown
79 lines
2.8 KiB
Markdown
# 🚀 The CI/CD Magic Template
|
|
|
|
Welcome to your deployment engine! This repository contains the "magic" `.gitea` folder that tells our server how to automatically build your website and put it on the internet.
|
|
|
|
Because modern tools (like Vite, Next.js, or Astro) create their own brand-new folders when you scaffold them, you **will not** write your code directly inside this template.
|
|
|
|
**Instead, you will create your app normally, and then "inject" the magic folder into it.**
|
|
|
|
---
|
|
|
|
## 🛠️ How to Start a New Project
|
|
|
|
**1. Scaffold your new website**
|
|
Open your terminal and generate your new app (for example, a Vite React app).
|
|
|
|
```bash
|
|
pnpm create vite@latest my-new-site -- --template react
|
|
cd my-new-site
|
|
pnpm install
|
|
```
|
|
|
|
**2. Download this template**
|
|
Open your file explorer, or use another terminal, and clone this template to your computer:
|
|
|
|
```bash
|
|
git clone https://git.pynixworld.com/Moody6/node-app-builder-template.git
|
|
```
|
|
|
|
**3. Inject the Magic**
|
|
Open the `node-app-builder-template` folder you just downloaded. Copy the hidden `.gitea` folder, and paste it directly into the _root_ your new `my-new-site` folder.
|
|
_(Important: The `.gitea` folder must sit right next to your `package.json` file!)_
|
|
|
|
**4. Connect to the Server**
|
|
Go to the Gitea website and create a brand new, empty repository. Then, go back to your `my-new-site` terminal and run these commands to link them:
|
|
|
|
```bash
|
|
git init
|
|
git checkout -b dev # We always start in the Dev environment!
|
|
git remote add origin https://git.pynixworld.com/YOUR_USERNAME/YOUR_NEW_REPO.git
|
|
```
|
|
|
|
**5. Launch It!**
|
|
Add your files, commit, and push. The server will take over from here.
|
|
|
|
```bash
|
|
git add .
|
|
git commit -m "Initial commit with deployment magic"
|
|
git push -u origin dev
|
|
```
|
|
|
|
_(Wait about 15 seconds, then check https://builder.pynixworld.com!)_
|
|
|
|
---
|
|
|
|
## 🌍 The Two Worlds (Environments)
|
|
|
|
This pipeline uses **Branches** to decide where your website goes.
|
|
|
|
- 🛠️ **The `dev` branch (Staging):** Pushing to this branch sends your site to [https://builder.pynixworld.com](https://builder.pynixworld.com). This is your playground. Break things, test new colors, and experiment here!
|
|
- 🌟 **The `main` branch (Production):** Pushing to this branch sends your site to [https://www.pynixworld.com](https://www.pynixworld.com). This is your official, live portfolio for the world to see.
|
|
|
|
To push to production, just merge your `dev` branch into `main` and push!
|
|
|
|
```bash
|
|
git checkout main
|
|
git merge dev
|
|
git push origin main
|
|
```
|
|
|
|
---
|
|
|
|
## 🧰 Changing Frameworks?
|
|
|
|
This pipeline is set for **React, SvelteKit, Vue, or Astro** right out of the box.
|
|
|
|
If you decide to try a different framework like Create React App, Next.js, or SvelteKit, you just need to tell the server which folder to look for.
|
|
|
|
Open `.gitea/workflows/deploy.yaml` and look for the `dist/*` folder to match your new framework (like `build/*` or `out/*`).
|