Skip to content

Commit a53a044

Browse files
committed
48: add release automation nextjs standalone deployments
1 parent 1063feb commit a53a044

3 files changed

Lines changed: 67 additions & 9 deletions

File tree

.github/workflows/release.yml

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,33 @@ on:
66
name: Create Release
77

88
jobs:
9-
build:
10-
name: Create Release
9+
build-and-release:
1110
runs-on: ubuntu-latest
11+
permissions:
12+
contents: write
1213
steps:
1314
- name: Checkout code
14-
uses: actions/checkout@v4
15+
uses: actions/checkout@v6
1516

16-
- name: Trigger deploy to production
17-
run: |
18-
curl -X POST -d {} ${{ secrets.DEPLOY_HOOK }}
17+
- name: Setup pnpm
18+
uses: pnpm/action-setup@v4
1919

20-
- name: Create Release
20+
- name: Setup Node.js
21+
uses: actions/setup-node@v4
22+
with:
23+
node-version: "24"
24+
cache: "pnpm"
25+
26+
- name: Install dependencies
27+
run: pnpm install
28+
29+
- name: Create release artifact
30+
run: ./scripts/create-release-artifact.sh
31+
32+
- name: Create GitHub Release
2133
uses: ncipollo/release-action@v1
2234
with:
23-
token: ${{ secrets.GITHUB_TOKEN }}
24-
draft: true
35+
artifacts: rallly-release.tar.gz
2536
generateReleaseNotes: true
37+
token: ${{ secrets.GITHUB_TOKEN }}
2638
makeLatest: true

apps/web/next.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ const nextConfig: NextConfig = {
2121
"@rallly/tailwind-config",
2222
"@rallly/posthog",
2323
"@rallly/emails",
24+
"@rallly/languages",
2425
],
2526
assetPrefix: process.env.NEXT_PUBLIC_BASE_URL,
2627
webpack(config) {

scripts/create-release-artifact.sh

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
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

Comments
 (0)