Update nextjs-cd.yml #33
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: Next.js CD | |
concurrency: | |
group: production | |
cancel-in-progress: true | |
on: | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
jobs: | |
build-and-deploy: | |
runs-on: self-hosted | |
environment: production | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Use Node.js (22.x) | |
uses: actions/setup-node@v4 | |
- name: Install Dependencies | |
run: npm ci | |
- name: Build NextJS | |
env: | |
GA_ID: ${{ secrets.GA_ID }} | |
run: | | |
npx next telemetry disable | |
pm2 stop 0 | |
rm -rf .next | |
npm run build | |
- name: Start NextJS | |
run: | | |
pm2 restart 0 --update-env |