Skip to content

Update docker-image.yml #8

Update docker-image.yml

Update docker-image.yml #8

Workflow file for this run

name: Sync CI/CD Workflow
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
jobs:
build:
runs-on: ubuntu-latest
steps:
# Step 1: Check out the repository
- name: Checkout code
uses: actions/checkout@v4
# Step 2: Set up Node.js
- name: Setup Node.js environment
uses: actions/setup-node@v4
with:
node-version: 20 # Specify the Node.js version
cache: 'npm'
# Step 3: Install dependencies
- name: Install dependencies
run: npm install
# Step 4: Build the Next.js project
- name: Build the Next.js application
run: npm run build
env:
UPSTASH_REDIS_REST_URL: ${{ secrets.UPSTASH_REDIS_REST_URL }}
UPSTASH_REDIS_REST_TOKEN: ${{ secrets.UPSTASH_REDIS_REST_TOKEN }}
GOOGLE_CLIENT_ID: ${{ secrets.GOOGLE_CLIENT_ID }}
GOOGLE_CLIENT_SECRET: ${{ secrets.GOOGLE_CLIENT_SECRET }}
NEXTAUTH_SECRET: ${{ secrets.NEXTAUTH_SECRET }}
PUSHER_APP_ID: ${{ secrets.PUSHER_APP_ID }}
NEXT_PUBLIC_PUSHER_KEY: ${{ secrets.NEXT_PUBLIC_PUSHER_KEY }}
PUSHER_SECRET: ${{ secrets.PUSHER_SECRET }}
PUSHER_CLUSTER: ${{ secrets.PUSHER_CLUSTER }}
NEXTAUTH_URL: ${{ secrets.NEXTAUTH_URL }}
# Step 5: Upload build artifacts (optional)
- name: Upload build artifacts
uses: actions/upload-artifact@v3
with:
name: nextjs-build
path: .next
include-hidden-files: true
if-no-files-found: warn
deploy:
runs-on: ubuntu-latest
needs: build
steps:
# Step 1: Checkout code
- name: Checkout code
uses: actions/checkout@v4
# Step 2: Setup Node.js
- name: Setup Node.js environment
uses: actions/setup-node@v4
with:
node-version: 20 # Specify the Node.js version
cache: 'npm'
# Step 3: Download build artifacts
- name: Download build artifacts
uses: actions/download-artifact@v3
with:
name: nextjs-build
# Step 4: Deploy to Vercel
- name: Deploy to Vercel
run: npx vercel --prod
env:
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
UPSTASH_REDIS_REST_URL: ${{ secrets.UPSTASH_REDIS_REST_URL }}
UPSTASH_REDIS_REST_TOKEN: ${{ secrets.UPSTASH_REDIS_REST_TOKEN }}
GOOGLE_CLIENT_ID: ${{ secrets.GOOGLE_CLIENT_ID }}
GOOGLE_CLIENT_SECRET: ${{ secrets.GOOGLE_CLIENT_SECRET }}
NEXTAUTH_SECRET: ${{ secrets.NEXTAUTH_SECRET }}
PUSHER_APP_ID: ${{ secrets.PUSHER_APP_ID }}
NEXT_PUBLIC_PUSHER_KEY: ${{ secrets.NEXT_PUBLIC_PUSHER_KEY }}
PUSHER_SECRET: ${{ secrets.PUSHER_SECRET }}
PUSHER_CLUSTER: ${{ secrets.PUSHER_CLUSTER }}
NEXTAUTH_URL: ${{ secrets.NEXTAUTH_URL }}