Github actions to create dist in server #14
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: Deploy to Vercel | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
deploy-frontend: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: "21.2.0" | |
- name: Install Vercel CLI | |
run: npm install -g vercel@latest | |
- name: List files in client directory | |
run: ls -la ./client | |
- name: Link and pull Vercel project for frontend | |
run: | | |
vercel link --yes --project ${{ secrets.FRONTEND_PROJECT_ID }} --scope ${{ secrets.VERCEL_TEAM }} --token=${{ secrets.VERCEL_TOKEN }} | |
vercel pull --yes --environment=preview --token=${{ secrets.VERCEL_TOKEN }} | |
working-directory: ./client | |
- name: Install frontend dependencies | |
run: npm install | |
working-directory: ./client | |
- name: Build frontend | |
run: npm run build | |
working-directory: ./client | |
- name: Deploy frontend to Vercel | |
run: vercel --token ${{ secrets.VERCEL_TOKEN }} | |
working-directory: ./client | |
deploy-backend: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: "21.2.0" | |
- name: Install Vercel CLI | |
run: npm install -g vercel@latest | |
- name: List files in server directory | |
run: ls -la ./server | |
- name: Link and pull Vercel project for backend | |
run: | | |
vercel link --yes --project ${{ secrets.BACKEND_PROJECT_ID }} --scope ${{ secrets.VERCEL_TEAM }} --token=${{ secrets.VERCEL_TOKEN }} | |
vercel pull --yes --environment=preview --token=${{ secrets.VERCEL_TOKEN }} | |
working-directory: ./server | |
- name: Install backend dependencies | |
run: npm install | |
working-directory: ./server | |
- name: Build backend | |
run: npm run build | |
working-directory: ./server | |
- name: List files in client directory | |
run: ls -la ./server | |
- name: Deploy backend to Vercel | |
run: vercel --token ${{ secrets.VERCEL_TOKEN }} | |
working-directory: ./server |