mirror of
https://github.com/sudoxnym/brands.git
synced 2026-05-17 02:58:51 +00:00
Add build scripts
This commit is contained in:
parent
546ed57275
commit
3bc07f8965
3 changed files with 80 additions and 0 deletions
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
build/*
|
||||
48
netlify.toml
Normal file
48
netlify.toml
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
[build]
|
||||
publish = "build"
|
||||
command = "bash ./scripts/build.sh"
|
||||
|
||||
[[headers]]
|
||||
for = "/_placeholder/*.png"
|
||||
[headers.values]
|
||||
Cache-Control = "public, max-age: 900, s-maxage=3600, must-revalidate"
|
||||
|
||||
[[headers]]
|
||||
for = "/*.png"
|
||||
[headers.values]
|
||||
Cache-Control = "public, max-age: 900, s-maxage=604800, must-revalidate"
|
||||
|
||||
[[redirects]]
|
||||
from = "/"
|
||||
to = "https://github.com/home-assistant/brands"
|
||||
force = true
|
||||
status = 301
|
||||
headers = {Cache-Control = "public, max-age: 900, s-maxage=604800, must-revalidate"}
|
||||
|
||||
[[redirects]]
|
||||
from = "/*/icon.png"
|
||||
to = "/_placeholder/icon.png"
|
||||
force = false
|
||||
status = 302
|
||||
headers = {Cache-Control = "public, max-age: 900, s-maxage=3600, must-revalidate"}
|
||||
|
||||
[[redirects]]
|
||||
from = "/*/logo.png"
|
||||
to = "/_placeholder/logo.png"
|
||||
force = false
|
||||
status = 302
|
||||
headers = {Cache-Control = "public, max-age: 900, s-maxage=3600, must-revalidate"}
|
||||
|
||||
[[redirects]]
|
||||
from = "/*/icon@2x.png"
|
||||
to = "/_placeholder/icon@2x.png"
|
||||
force = false
|
||||
status = 302
|
||||
headers = {Cache-Control = "public, max-age: 900, s-maxage=3600, must-revalidate"}
|
||||
|
||||
[[redirects]]
|
||||
from = "/*/logo@2x.png"
|
||||
to = "/_placeholder/logo@2x.png"
|
||||
force = false
|
||||
status = 302
|
||||
headers = {Cache-Control = "public, max-age: 900, s-maxage=3600, must-revalidate"}
|
||||
31
scripts/build.sh
Executable file
31
scripts/build.sh
Executable file
|
|
@ -0,0 +1,31 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# Copy folder, without symlinks, but use actual files instead
|
||||
rsync -aL --exclude '_homeassistant' src/ build
|
||||
|
||||
# Use icon as logo in case of a missing logo
|
||||
find ./build -type f -name "icon.png" | while read icon; do
|
||||
dir=$(dirname "${icon}")
|
||||
if [[ ! -f "${dir}/logo.png" ]]; then
|
||||
cp "${icon}" "${dir}/logo.png"
|
||||
echo "Using ${icon} as logo"
|
||||
fi
|
||||
done
|
||||
|
||||
# Use icon as icon@2x in case it is missing
|
||||
find ./build -type f -name "icon.png" | while read icon; do
|
||||
dir=$(dirname "${icon}")
|
||||
if [[ ! -f "${dir}/icon@2x.png" ]]; then
|
||||
cp "${icon}" "${dir}/icon@2x.png"
|
||||
echo "Using ${icon} as hDPI icon"
|
||||
fi
|
||||
done
|
||||
|
||||
# Use logo as logo@2x in case it is missing
|
||||
find ./build -type f -name "logo.png" | while read logo; do
|
||||
dir=$(dirname "${logo}")
|
||||
if [[ ! -f "${dir}/logo@2x.png" ]]; then
|
||||
cp "${logo}" "${dir}/logo@2x.png"
|
||||
echo "Using ${logo} as hDPI logo"
|
||||
fi
|
||||
done
|
||||
Loading…
Reference in a new issue