Redirect wasm preview site

This commit is contained in:
halx99 2023-09-11 20:01:56 +08:00
parent dc1ac3cef2
commit aa12c467f4
3 changed files with 43 additions and 6 deletions

2
docs/.gitignore vendored
View File

@ -1,4 +1,4 @@
dist/
dist*
.tee-*.txt
Doxyfile
build*

View File

@ -61,7 +61,9 @@
<h2 id="documentation">WASM preview</h2>
<ul>
<li><a href="https://axmolengine.github.io/axmol/wasm/cpp_tests/cpp_tests.html">cpp_tests</a></li>
<li><a href="https://axmol.netlify.app/wasm/cpp_tests/cpp_tests">cpp_tests</a></li>
<li><a href='https://axmol.netlify.app/wasm/fairygui_tests/fairygui_tests'>fairygui_tests</a></li>
<li><a href='https://axmol.netlify.app/wasm/hellolua/hellolua'>HelloLua</a></li>
</ul>
<footer class="site-footer">

View File

@ -153,10 +153,45 @@ mkdirs "$site_dist/assets/css"
Copy-Item './style.css' "$site_dist/assets/css/style.css"
Copy-Item './index.html' "$site_dist/index.html"
# deploy wasm cpp_tests demo
# deploy wasm demos to site_dist2
download_zip_expand 'https://ci.appveyor.com/api/projects/halx99/axmol/artifacts/build_wasm.zip?branch=dev' $(Join-Path $AX_ROOT 'tmp/build_wasm.zip')
$wasm_dist = Join-Path $site_dist 'wasm/'
mkdirs $wasm_dist
Copy-Item $(Join-Path $AX_ROOT 'tmp/build_wasm/bin/cpp_tests') $wasm_dist -Container -Recurse
$wasm_dist2 = Join-Path $site_src 'dist2/wasm/'
mkdirs $wasm_dist2
function copy_tree_if($source, $dest) {
if (Test-Path $source) {
Copy-Item $source $dest -Container -Recurse
}
}
copy_tree_if $(Join-Path $AX_ROOT 'tmp/build_wasm/bin/cpp_tests') $wasm_dist2
copy_tree_if $(Join-Path $AX_ROOT 'tmp/build_wasm/bin/fairygui_tests') $wasm_dist2
copy_tree_if $(Join-Path $AX_ROOT 'tmp/build_wasm/bin/HelloLua') $wasm_dist2
# redirect old url
$fake_cpp_tests = Join-Path $site_dist 'wasm/cpp_tests/'
mkdirs $fake_cpp_tests
$fake_cpp_tests_html = Join-Path $fake_cpp_tests 'cpp_tests.html'
$redirect_content = @'
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Redirecting</title>
<noscript>
<meta http-equiv="refresh" content="1; url={0}" />
</noscript>
<script>
window.location.href = '{0}';
</script>
</head>
<body>
Redirecting to <a href="{0}">{0}</a>
</body>
</html>
'@ -f 'https://axmol.netlify.app/wasm/cpp_tests/cpp_tests'
Set-Content -Path $fake_cpp_tests_html -Value $redirect_content
Set-Location $store_cwd