lol #322
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- apps/web/**/* | |
- packages/db/**/* | |
- .github/workflows/build.yml | |
- bun.lock | |
- bun.lockb | |
pull_request: | |
branches: | |
- main | |
paths: | |
- apps/web/* | |
- packages/db/* | |
permissions: | |
contents: read | |
jobs: | |
website: | |
name: Build Next.JS App | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup Bun | |
uses: oven-sh/setup-bun@v2 | |
with: | |
bun-version: latest | |
- uses: actions/cache@v4 | |
with: | |
path: apps/web/.next/cache | |
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/bun.lock') }} | |
restore-keys: ${{ runner.os }}-nextjs-${{ hashFiles('**/bun.lock') }} | |
- name: Install deps | |
run: bun install --frozen-lockfile && touch bun.lockb | |
- name: Build | |
run: | | |
set -o pipefail | |
bun run build 2>&1 | tee -a build.log | |
working-directory: apps/web | |
env: | |
STANDALONE: "1" | |
# TURBOPACK_BUILD: 1 | |
# TURBOPACK: 1 | |
# TURBO: 1 | |
DATABASE_URL: "libsql://void.riskymh.dev" | |
EMAIL_AUTH_TOKEN: "no" | |
S3_KEY_ID: "no" | |
NEXT_PUBLIC_APP_URL: "https://emailthing.xyz" | |
WEB_NOTIFICATIONS_PRIVATE_KEY: "no" | |
NEXT_PUBLIC_NOTIFICATIONS_PUBLIC_KEY: ${{ vars.NEXT_PUBLIC_NOTIFICATIONS_PUBLIC_KEY }} | |
S3_URL: "no" | |
S3_SECRET_ACCESS_KEY: "no" | |
- name: Echo build log to $GITHUB_STEP_SUMMARY | |
run: | | |
echo "\`\`\`txt" >> $GITHUB_STEP_SUMMARY | |
cat apps/web/build.log >> $GITHUB_STEP_SUMMARY | |
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY | |
- name: Copy static asset files | |
working-directory: apps/web | |
run: | | |
ls .next/standalone/* | |
mkdir --parents ./.next/standalone/public/_next/static | |
cp ./public -r ./.next/standalone | |
cp ./.next/static -r ./.next/standalone/public/_next | |
(mv ./.next/standalone/public/* ./.next/standalone/apps/web/public) || true | |
(mv ./.next/standalone/apps/web/* ./.next/standalone) || true | |
(mv ./.next/standalone/apps/web/.[!.]* ./.next/standalone) || true | |
cp ../../node_modules/@libsql/isomorphic-fetch/node.js ./.next/standalone/node_modules/@libsql/isomorphic-fetch/web.js | |
cp ../../node_modules/@libsql/isomorphic-fetch/node.js ./.next/standalone/node_modules/@libsql/isomorphic-fetch/web.cjs | |
cp ../../node_modules/@libsql/isomorphic-ws/node.mjs ./.next/standalone/node_modules/@libsql/isomorphic-ws/web.cjs | |
- uses: actions/upload-artifact@v4 | |
with: | |
path: apps/web/.next/standalone | |
name: Standalone Next.js | |
compression-level: 1 | |
include-hidden-files: true |