Update deployment workflow and layout metadata for Next.js application. Added environment variable for site URL in the GitHub Actions workflow and adjusted metadata generation to use this variable. Enhanced icon definitions for better responsiveness in layout.

This commit is contained in:
smhk1376 committed 2026-09-24 15:47:02 +03:30
1 parent 95841ab09a
commit 19fe962143
4 files changed
+24 -7

No files matched your search

+16 -4
View File
@@ -30,6 +30,7 @@ jobs:
env: env:
DISABLE_REACT_COMPILER: "1" DISABLE_REACT_COMPILER: "1"
NEXT_TELEMETRY_DISABLED: "1" NEXT_TELEMETRY_DISABLED: "1"
NEXT_PUBLIC_SITE_URL: https://aut.insaight.net
run: | run: |
set -euo pipefail set -euo pipefail
npm ci --no-audit --no-fund npm ci --no-audit --no-fund
@@ -46,16 +47,22 @@ jobs:
# Flatten standalone to artifact root (includes .next + node_modules) # Flatten standalone to artifact root (includes .next + node_modules)
cp -a .next/standalone/. prebuilt/ cp -a .next/standalone/. prebuilt/
# Static assets + public (required next to standalone) # Next must NOT see a root-level ./static (legacy); only ./.next/static
cp -a .next/static prebuilt/.next/static rm -rf prebuilt/static
rm -rf prebuilt/.next/static
mkdir -p prebuilt/.next
cp -a .next/static/. prebuilt/.next/static/
if [ -d public ]; then if [ -d public ]; then
rm -rf prebuilt/public
cp -a public prebuilt/public cp -a public prebuilt/public
else else
mkdir -p prebuilt/public mkdir -p prebuilt/public
fi fi
# Dockerfile travels with the artifact so deploy context is self-contained # Build recipe for deploy job (excluded from image via .dockerignore)
cp Dockerfile.prebuilt prebuilt/Dockerfile cp Dockerfile.prebuilt prebuilt/Dockerfile
printf '%s\n' 'Dockerfile' '.dockerignore' > prebuilt/.dockerignore
echo "Assembled tree:" echo "Assembled tree:"
ls -la prebuilt ls -la prebuilt
@@ -64,6 +71,11 @@ jobs:
test -f prebuilt/.next/BUILD_ID test -f prebuilt/.next/BUILD_ID
test -d prebuilt/.next/static test -d prebuilt/.next/static
test -d prebuilt/node_modules test -d prebuilt/node_modules
# Fail if legacy root static leaked in
if [ -e prebuilt/static ]; then
echo "ERROR: root-level static/ must not exist" >&2
exit 1
fi
- uses: actions/upload-artifact@v4 - uses: actions/upload-artifact@v4
with: with:
@@ -102,7 +114,7 @@ jobs:
# Confirm BUILD_ID is actually inside the image # Confirm BUILD_ID is actually inside the image
docker run --rm --entrypoint sh "$IMAGE_NAME" -c \ docker run --rm --entrypoint sh "$IMAGE_NAME" -c \
'test -f /app/.next/BUILD_ID && test -f /app/server.js && ls -la /app/.next' 'test -f /app/.next/BUILD_ID && test -f /app/server.js && test -d /app/.next/static && test ! -e /app/static && ls -la /app && ls -la /app/.next'
- name: Restart container - name: Restart container
env: env:
Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

+8 -3
View File
@@ -54,17 +54,22 @@ const iranSans = localFont({
export async function generateMetadata(): Promise<Metadata> { export async function generateMetadata(): Promise<Metadata> {
const t = await getTranslations("meta"); const t = await getTranslations("meta");
const siteUrl =
process.env.NEXT_PUBLIC_SITE_URL ?? "https://aut.insaight.net";
return { return {
metadataBase: new URL("https://openedu.aut.ac.ir"), metadataBase: new URL(siteUrl),
title: { title: {
default: t("homeTitle"), default: t("homeTitle"),
template: `%s | ${t("homeTitle")}`, template: `%s | ${t("homeTitle")}`,
}, },
description: t("homeDescription"), description: t("homeDescription"),
icons: { icons: {
icon: [{ url: "/brand/amirkabir.png", type: "image/png" }], icon: [
{ url: "/brand/amirkabir.png", sizes: "32x32", type: "image/png" },
{ url: "/brand/amirkabir.png", sizes: "192x192", type: "image/png" },
],
apple: [{ url: "/brand/amirkabir.png", type: "image/png" }], apple: [{ url: "/brand/amirkabir.png", type: "image/png" }],
shortcut: "/brand/amirkabir.png", shortcut: ["/brand/amirkabir.png"],
}, },
openGraph: { openGraph: {
type: "website", type: "website",