chore(stack): 切换到 default 模式,同步根目录状态

This commit is contained in:
augushong
2026-05-27 21:53:35 +08:00
parent ceed8d3e71
commit 95698afa18
4 changed files with 23 additions and 122 deletions

View File

@@ -22,6 +22,10 @@ jobs:
with:
fetch-depth: 1
- name: 切换到 docker-serve 模式
shell: bash
run: php think admin:stack:mode use docker-serve -f
- name: 生成 .env
shell: bash
env:
@@ -29,37 +33,27 @@ jobs:
DB_HOSTNAME: ${{ env.DB_HOSTNAME }}
run: |
set -euo pipefail
if [ ! -f .env ]; then
cp .example.env .env
cp .example.env .env
awk -v host="$DB_HOSTNAME" -v newpwd="$MYSQL_PASSWORD" '
BEGIN { has_host = 0; has_pwd = 0; has_demo = 0 }
$0 ~ /^HOSTNAME=/ {
print "HOSTNAME=" host
has_host = 1
next
}
$0 ~ /^PASSWORD=/ {
print "PASSWORD=" newpwd
has_pwd = 1
next
}
$0 ~ /^IS_DEMO=/ {
print "IS_DEMO=true"
has_demo = 1
next
}
{ print }
END {
if (!has_host) print "HOSTNAME=" host
if (!has_pwd) print "PASSWORD=" newpwd
if (!has_demo) print "IS_DEMO=true"
}' .env > .env.tmp
awk -v host="$DB_HOSTNAME" -v newpwd="$MYSQL_PASSWORD" '
BEGIN { has_host = 0; has_pwd = 0 }
$0 ~ /^HOSTNAME=/ {
print "HOSTNAME=" host
has_host = 1
next
}
$0 ~ /^PASSWORD=/ {
print "PASSWORD=" newpwd
has_pwd = 1
next
}
{ print }
END {
if (!has_host) print "HOSTNAME=" host
if (!has_pwd) print "PASSWORD=" newpwd
}' .env > .env.tmp
mv .env.tmp .env
else
echo ".env exists in repository, skip generating/replacing."
fi
mv .env.tmp .env
- name: 打包发布文件
shell: bash