Update .env.example #3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and Deploy Twitter App | |
# Trigger the workflow on push or pull request to the main branch | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
# Define the jobs that will run | |
jobs: | |
build: | |
# Use the latest Ubuntu runner | |
runs-on: ubuntu-latest | |
# Define the steps in the build job | |
steps: | |
# Step 1: Check out the repository | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
# Step 2: Set up Node.js (use the required Node version) | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '18' # You can specify your Node.js version | |
# Step 3: Install dependencies for both backend and frontend | |
- name: Install dependencies | |
run: | | |
npm install | |
npm install --prefix frontend | |
# Step 4: Build the frontend (assuming your frontend build script is set) | |
- name: Build frontend | |
run: npm run build --prefix frontend | |
# Step 5: Run backend server (development) | |
- name: Start backend server | |
env: | |
MONGO_URI: ${{ secrets.MONGO_URI }} | |
PORT: ${{ secrets.PORT }} | |
JWT_SECRET: ${{ secrets.JWT_SECRET }} | |
CLOUDINARY_CLOUD_NAME: ${{ secrets.CLOUDINARY_CLOUD_NAME }} | |
CLOUDINARY_API_KEY: ${{ secrets.CLOUDINARY_API_KEY }} | |
CLOUDINARY_API_SECRET: ${{ secrets.CLOUDINARY_API_SECRET }} | |
NODE_ENV: development | |
run: npm run dev | |
# Optional: Add a step to run tests (if you have test scripts) | |
# - name: Run tests | |
# run: npm test |