45 lines
1002 B
YAML
45 lines
1002 B
YAML
image: oven/bun:alpine
|
|
|
|
stages:
|
|
- build
|
|
- deploy
|
|
|
|
cache:
|
|
key:
|
|
files:
|
|
- bun.lock
|
|
paths:
|
|
- .next/cache/
|
|
- node_modules/
|
|
|
|
build_job:
|
|
stage: build
|
|
tags:
|
|
- nextjs
|
|
rules:
|
|
- if: $CI_COMMIT_BRANCH == "main"
|
|
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
|
|
script:
|
|
- echo "Installing dependencies..."
|
|
- bun install --frozen-lockfile
|
|
- echo "Building the Next.js application..."
|
|
- bun run build
|
|
artifacts:
|
|
paths:
|
|
- .next/
|
|
- public/
|
|
- package.json
|
|
expire_in: 1 week
|
|
|
|
deploy_production:
|
|
stage: deploy
|
|
image: curlimages/curl:latest
|
|
tags:
|
|
- nextjs
|
|
rules:
|
|
- if: $CI_COMMIT_BRANCH == "main"
|
|
needs: ["build_job"]
|
|
script:
|
|
- echo "Triggering Portainer GitOps Webhook..."
|
|
- curl -X POST "https://portainer.vpn.pascalyazid.com/api/stacks/webhooks/f79fde36-37fa-43ca-a414-a6df780b0c59"
|