Update .gitlab-ci.yml file

This commit is contained in:
kris
2026-02-02 04:35:36 +00:00
parent e169068e1c
commit 0efae3089d
+7 -31
View File
@@ -16,47 +16,24 @@ default:
.build_template: &build_template
stage: build
image: node:20-alpine
cache:
key: npm-cache
paths:
- node_modules/
variables:
NODE_ENV: ""
NPM_CONFIG_PRODUCTION: "false"
NPM_CONFIG_PRODUCTION: 'false'
NODE_ENV: ''
script:
# Install dependencies
- echo "📦 Installing dependencies..."
- echo "Installing dependencies..."
- npm ci --no-audit --no-fund
# Print env used
- echo "✅ Build env used:"
- echo "Build env used:"
- echo "NEXT_PUBLIC_LTI_URL=$NEXT_PUBLIC_LTI_URL"
- echo "NEXT_PUBLIC_SSO_LOGIN_URL=$NEXT_PUBLIC_SSO_LOGIN_URL"
- echo "NEXT_PUBLIC_API_BASE_URL=$NEXT_PUBLIC_API_BASE_URL"
# Clean old output
- echo "🧹 Cleaning old build..."
- rm -rf .next out
# Build Next.js
- echo "🏗️ Running Next.js build..."
- echo "Building Next.js static export..."
- npx next build
# Export static site
- echo "📤 Exporting static site..."
- npx next export
# Validate export result
- echo "🔍 Validating export output..."
- test -f out/index.html || (echo "❌ out/index.html missing" && exit 1)
- test -d out/_next/static || (echo "❌ out/_next/static missing" && exit 1)
# Build metadata
- echo "📝 Writing build-info.json..."
- |
mkdir -p out
cat <<EOF > out/build-info.json
{
"commit": "$CI_COMMIT_SHORT_SHA",
@@ -67,9 +44,8 @@ default:
"NEXT_PUBLIC_API_BASE_URL": "$NEXT_PUBLIC_API_BASE_URL"
}
EOF
artifacts:
name: "out-$CI_COMMIT_SHORT_SHA"
name: 'out-$CI_COMMIT_SHORT_SHA'
paths:
- out/
expire_in: 1 week