|
| 1 | +#!/bin/bash |
| 2 | + |
| 3 | +# Exit on any error |
| 4 | +set -e |
| 5 | + |
| 6 | +echo "📦 Creating release artifact..." |
| 7 | + |
| 8 | +# 1. Clean up previous artifacts if they exist |
| 9 | +rm -f rallly-release.tar.gz |
| 10 | +rm -rf ./release-artifact |
| 11 | + |
| 12 | +# 2. Build the project |
| 13 | +echo "⚙️ Building the Next.js application..." |
| 14 | +pnpm build |
| 15 | + |
| 16 | +# 3. Create the artifact directory |
| 17 | +mkdir -p ./release-artifact |
| 18 | + |
| 19 | +# 4. Copy the standalone server output |
| 20 | +echo "🚚 Copying standalone server files..." |
| 21 | +cp -r apps/web/.next/standalone/* ./release-artifact/ |
| 22 | + |
| 23 | +# 5. Copy the static assets |
| 24 | +echo "🖼️ Copying static assets..." |
| 25 | +mkdir -p ./release-artifact/apps/web/.next/ |
| 26 | +cp -r apps/web/.next/static ./release-artifact/apps/web/.next/static |
| 27 | + |
| 28 | +# 6. Copy the public folder |
| 29 | +echo "📁 Copying public assets..." |
| 30 | +cp -r apps/web/public ./release-artifact/apps/web/public |
| 31 | + |
| 32 | +# 7. Copy the Prisma schema for migrations |
| 33 | +echo "🗄️ Copying Prisma schema and config..." |
| 34 | +mkdir -p ./release-artifact/prisma |
| 35 | +cp -r packages/database/prisma/* ./release-artifact/prisma |
| 36 | +cp packages/database/prisma.config.ts ./release-artifact/ |
| 37 | + |
| 38 | +# 8. Create the compressed tarball |
| 39 | +echo "🗜️ Compressing the artifact..." |
| 40 | +tar -czf rallly-release.tar.gz -C ./release-artifact . |
| 41 | + |
| 42 | +# 9. Clean up the temporary artifact directory |
| 43 | +rm -rf ./release-artifact |
| 44 | + |
| 45 | +echo "✅ Release artifact created: rallly-release.tar.gz" |
0 commit comments