Skip to content

Commit 6016917

Browse files
authored
Merge pull request #16 from duylongpro99/development
Development
2 parents b757b10 + 1634901 commit 6016917

File tree

2 files changed

+93
-0
lines changed

2 files changed

+93
-0
lines changed

.github/workflows/build.yml

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
name: Build Application
2+
3+
on:
4+
pull_request:
5+
types: [closed]
6+
branches: [main]
7+
jobs:
8+
build:
9+
if: github.event.pull_request.merged == true
10+
11+
name: "Build Application"
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Checkout Code
16+
uses: actions/checkout@v4
17+
18+
- name: Setup Node.js
19+
uses: actions/setup-node@v4
20+
with:
21+
node-version: "20"
22+
23+
- name: Install pnpm
24+
uses: pnpm/action-setup@v2
25+
with:
26+
version: 8
27+
run_install: false
28+
29+
- name: Get pnpm store directory
30+
id: pnpm-cache
31+
shell: bash
32+
run: |
33+
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
34+
35+
- name: Setup pnpm cache
36+
uses: actions/cache@v3
37+
with:
38+
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
39+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
40+
restore-keys: |
41+
${{ runner.os }}-pnpm-store-
42+
43+
# Install dependencies with fallback logic
44+
- name: Install dependencies
45+
run: |
46+
# Attempt to install with --frozen-lockfile first
47+
if pnpm install --frozen-lockfile; then
48+
echo "Successfully installed dependencies with frozen lockfile"
49+
else
50+
echo "Failed to install with frozen lockfile, attempting normal install"
51+
# Remove potentially incompatible lockfile
52+
rm -f pnpm-lock.yaml
53+
# Run regular install
54+
pnpm install
55+
fi
56+
57+
# Set up environment variables from GitHub secrets
58+
- name: Set up environment variables
59+
run: |
60+
# Create .env file
61+
touch .env
62+
63+
# Add Convex specific variables
64+
echo "NEXT_PUBLIC_CONVEX_URL=${{ secrets.NEXT_PUBLIC_CONVEX_URL }}" >> .env
65+
echo "CONVEX_DEPLOYMENT=${{ secrets.CONVEX_DEPLOYMENT }}" >> .env
66+
67+
# Add other public and private environment variables
68+
echo "CLERK_SECRET_KEY=${{ secrets.CLERK_SECRET_KEY }}" >> .env
69+
echo "NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=${{ secrets.NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY }}" >> .env
70+
71+
# Liveblocks secret key:
72+
echo "LIVE_BLOCK_SECRET_API_KEY=${{secrets.LIVE_BLOCK_SECRET_API_KEY}}" >> .env
73+
74+
- name: Build
75+
run: pnpm build
76+
env:
77+
NEXT_PUBLIC_CONVEX_URL: ${{ secrets.NEXT_PUBLIC_CONVEX_URL }}
78+
79+
# Upload the build artifacts to be used by the deploy job
80+
- name: Upload build artifacts
81+
uses: actions/upload-artifact@v4
82+
with:
83+
name: build-output
84+
path: |
85+
.next
86+
public
87+
package.json
88+
pnpm-lock.yaml
89+
next.config.js
90+
.env

.github/workflows/deploy.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,9 @@ jobs:
6565
echo "CLERK_SECRET_KEY=${{ secrets.CLERK_SECRET_KEY }}" >> .env
6666
echo "NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY=${{ secrets.NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY }}" >> .env
6767
68+
# Liveblocks secret key:
69+
echo "LIVE_BLOCK_SECRET_API_KEY=${{secrets.LIVE_BLOCK_SECRET_API_KEY}}" >> .env
70+
6871
- name: Build
6972
run: pnpm build
7073
env:

0 commit comments

Comments
 (0)