Migre le projet vers Blazor WebAssembly en .NET 10
This commit is contained in:
@@ -181,11 +181,30 @@ trap 'printf \"Erreur: echec de la commande [%s] a la ligne %s.\\n\" \"\$BASH_CO
|
||||
|
||||
main_repo_dir='/opt/chesscubing/repo'
|
||||
ethan_repo_dir='/opt/chesscubing/ethan-repo'
|
||||
publish_root='/opt/chesscubing/publish'
|
||||
web_root='/var/www/chesscubing/current'
|
||||
main_branch=\"\${1:-${repo_branch}}\"
|
||||
ethan_repo_url='${ethan_repo_url}'
|
||||
ethan_branch='${ethan_repo_branch}'
|
||||
|
||||
ensure_dotnet_sdk() {
|
||||
if command -v dotnet >/dev/null 2>&1; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
apt-get update
|
||||
apt-get install -y ca-certificates curl gpg
|
||||
|
||||
if [[ ! -f /etc/apt/sources.list.d/microsoft-prod.list ]]; then
|
||||
curl -fsSL https://packages.microsoft.com/config/debian/12/packages-microsoft-prod.deb -o /tmp/packages-microsoft-prod.deb
|
||||
dpkg -i /tmp/packages-microsoft-prod.deb
|
||||
rm -f /tmp/packages-microsoft-prod.deb
|
||||
fi
|
||||
|
||||
apt-get update
|
||||
apt-get install -y dotnet-sdk-10.0
|
||||
}
|
||||
|
||||
sync_git_repo() {
|
||||
local repo_dir=\"\$1\"
|
||||
local repo_url=\"\$2\"
|
||||
@@ -219,6 +238,15 @@ sync_git_repo() {
|
||||
git clone --branch \"\$branch\" --single-branch \"\$repo_url\" \"\$repo_dir\"
|
||||
}
|
||||
|
||||
publish_blazor_app() {
|
||||
local repo_dir=\"\$1\"
|
||||
local output_dir=\"\$2\"
|
||||
|
||||
ensure_dotnet_sdk
|
||||
rm -rf \"\$output_dir\"
|
||||
dotnet publish \"\$repo_dir/ChessCubing.App/ChessCubing.App.csproj\" -c Release -o \"\$output_dir\"
|
||||
}
|
||||
|
||||
publish_static_tree() {
|
||||
local source_dir=\"\$1\"
|
||||
local destination_dir=\"\$2\"
|
||||
@@ -246,17 +274,12 @@ publish_static_tree() {
|
||||
sync_git_repo \"\$main_repo_dir\" '' \"\$main_branch\" 'principal'
|
||||
sync_git_repo \"\$ethan_repo_dir\" \"\$ethan_repo_url\" \"\$ethan_branch\" 'Ethan'
|
||||
|
||||
asset_version=\"\$(git -C \"\$main_repo_dir\" rev-parse --short HEAD)-\$(git -C \"\$ethan_repo_dir\" rev-parse --short HEAD)\"
|
||||
install -d -m 0755 \"\$web_root\" \"\$publish_root\"
|
||||
|
||||
install -d -m 0755 \"\$web_root\"
|
||||
|
||||
publish_static_tree \"\$main_repo_dir\" \"\$web_root\"
|
||||
publish_blazor_app \"\$main_repo_dir\" \"\$publish_root/main\"
|
||||
rsync -a --delete \"\$publish_root/main/wwwroot/\" \"\$web_root/\"
|
||||
publish_static_tree \"\$ethan_repo_dir\" \"\$web_root/ethan\"
|
||||
|
||||
while IFS= read -r -d '' html_file; do
|
||||
LC_ALL=C LANG=C ASSET_VERSION=\"\$asset_version\" perl -0pi -e 's{((?:href|src)=\")(?!https?://|data:|//)([^\"?]+?\.(?:css|js|mjs|png|jpg|jpeg|svg|webp|ico|pdf|webmanifest))(?:\?[^\"]*)?(\")}{\$1 . \$2 . \"?v=\" . \$ENV{ASSET_VERSION} . \$3}ge' \"\$html_file\"
|
||||
done < <(find \"\$web_root\" -type f -name '*.html' -print0)
|
||||
|
||||
chown -R www-data:www-data \"\$web_root\"
|
||||
|
||||
nginx -t
|
||||
|
||||
Reference in New Issue
Block a user