mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-20 05:22:02 +00:00
Update .gitlab-ci.yml file
This commit is contained in:
+27
-20
@@ -16,32 +16,46 @@ default:
|
||||
.build_template: &build_template
|
||||
stage: build
|
||||
image: node:20-alpine
|
||||
|
||||
cache:
|
||||
key: npm-cache
|
||||
paths:
|
||||
- node_modules/
|
||||
|
||||
variables:
|
||||
NPM_CONFIG_PRODUCTION: 'false'
|
||||
NODE_ENV: ''
|
||||
NODE_ENV: ""
|
||||
NPM_CONFIG_PRODUCTION: "false"
|
||||
|
||||
script:
|
||||
- echo "Installing dependencies..."
|
||||
# Install dependencies
|
||||
- echo "📦 Installing dependencies..."
|
||||
- npm ci --no-audit --no-fund
|
||||
|
||||
- echo "Build env used:"
|
||||
# Print 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"
|
||||
- echo "NEXT_PUBLIC_CLIENT_ID=$NEXT_PUBLIC_CLIENT_ID"
|
||||
|
||||
# ✅ Build Next
|
||||
- echo "Building Next.js..."
|
||||
# Clean old output
|
||||
- echo "🧹 Cleaning old build..."
|
||||
- rm -rf .next out
|
||||
|
||||
# Build Next.js
|
||||
- echo "🏗️ Running Next.js build..."
|
||||
- npx next build
|
||||
|
||||
# ✅ Export static to out/ (ini yang sebelumnya missing)
|
||||
- echo "Exporting Next.js static site to ./out ..."
|
||||
- npx next export -o out
|
||||
# Export static site
|
||||
- echo "📤 Exporting static site..."
|
||||
- npx next export
|
||||
|
||||
# build-info.json tetap kamu simpan di out/
|
||||
# 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..."
|
||||
- |
|
||||
cat <<EOF > out/build-info.json
|
||||
{
|
||||
@@ -50,19 +64,12 @@ default:
|
||||
"built_at": "$(date -u +"%Y-%m-%dT%H:%M:%SZ")",
|
||||
"NEXT_PUBLIC_LTI_URL": "$NEXT_PUBLIC_LTI_URL",
|
||||
"NEXT_PUBLIC_SSO_LOGIN_URL": "$NEXT_PUBLIC_SSO_LOGIN_URL",
|
||||
"NEXT_PUBLIC_API_BASE_URL": "$NEXT_PUBLIC_API_BASE_URL",
|
||||
"NEXT_PUBLIC_CLIENT_ID": "$NEXT_PUBLIC_CLIENT_ID"
|
||||
"NEXT_PUBLIC_API_BASE_URL": "$NEXT_PUBLIC_API_BASE_URL"
|
||||
}
|
||||
EOF
|
||||
|
||||
# ✅ Verifikasi cepat (biar ketahuan out/ isinya bener)
|
||||
- echo "===== out/ preview ====="
|
||||
- ls -lah out | head -n 50
|
||||
- echo "===== _next assets preview ====="
|
||||
- ls -lah out/_next/static/chunks 2>/dev/null | head -n 30 || true
|
||||
|
||||
artifacts:
|
||||
name: 'out-$CI_COMMIT_SHORT_SHA'
|
||||
name: "out-$CI_COMMIT_SHORT_SHA"
|
||||
paths:
|
||||
- out/
|
||||
expire_in: 1 week
|
||||
|
||||
Reference in New Issue
Block a user