Skip to content

Commit d014f2c

Browse files
committed
chore: workflow add docker prompt test
1 parent 6520b64 commit d014f2c

File tree

2 files changed

+23
-2
lines changed

2 files changed

+23
-2
lines changed

.github/workflows/deploy.yml

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,15 @@ jobs:
3131
echo "$SSH_PRIVATE_KEY" > ~/.ssh/id_rsa
3232
chmod 600 ~/.ssh/id_rsa
3333
ssh-keyscan $SSH_HOST >> ~/.ssh/known_hosts
34-
ssh $SSH_USER@$SSH_HOST << EOF
34+
ssh $SSH_USER@$SSH_HOST << 'EOF'
3535
cd $BLOG_PATH_REMOTE
3636
3737
MAX_RETRIES=8
3838
RETRY_COUNT=0
3939
4040
while [ \$RETRY_COUNT -lt \$MAX_RETRIES ]; do
4141
if git pull origin main; then
42-
break # pull succesful exit
42+
break # pull successful, exit loop
4343
else
4444
echo "Git pull failed, retrying (\$((RETRY_COUNT + 1)) of \$MAX_RETRIES)..."
4545
((RETRY_COUNT++))
@@ -52,4 +52,20 @@ jobs:
5252
echo "Failed to pull code after \$MAX_RETRIES attempts. Exiting."
5353
exit 1 # throw error
5454
fi
55+
56+
# Build Docker image
57+
docker build -t nextjs .
58+
59+
# Stop the running container (if any)
60+
if docker ps -q --filter "name=blog" | grep -q .; then
61+
docker stop blog
62+
fi
63+
64+
# Remove the stopped container (optional, but recommended for cleanup)
65+
if docker ps -aq --filter "name=blog" | grep -q .; then
66+
docker rm blog
67+
fi
68+
69+
# Start the new container using docker-compose
70+
docker compose up -d
5571
EOF

components/layouts/page-header/mobile-nav.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,11 @@ export default function MobileNav() {
3434
</Button>
3535
</DropdownMenuTrigger>
3636
<DropdownMenuContent className="ml-4">
37+
<Link href="/">
38+
<DropdownMenuItem className={cn({ 'bg-gray-100': pathname == '/' })}>
39+
首页
40+
</DropdownMenuItem>
41+
</Link>
3742
{siteConfig.navs.map((item) => (
3843
<Link href={item.href} key={item.href}>
3944
<DropdownMenuItem className={cn({ 'bg-gray-100': pathname == item.href })}>

0 commit comments

Comments
 (0)