summaryrefslogtreecommitdiff
path: root/publish
blob: 5dc7424c0c5569c4d74a2e447b5995f1cf048bc5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#!/bin/sh

HERE=$(dirname $(readlink -f ${0}))/src;

HTML=html;
TEMP=$(mktemp -d);
chmod 755 ${TEMP};

##
# CSS
#
(cd assets/css && ./compile.sh)

##
# Logo
#
(cd assets/images && ./polyguin.sh)

#===============================================================
docker run -v ${HERE}:${HERE} -e HERE=${HERE} -v ${TEMP}:${TEMP} -e TEMP=${TEMP} --rm -i alpine:3.14 <<'EOF'
apk add findutils imagemagick;
#===============================================================

##
# .psd --> .jpg ONLY in 'src/'
#
find ${HERE} -type f -name "*.psd" | while read k; do
    f="${k#*${HERE}}";
    mkdir -p "${TEMP}${f%/*}";
    convert "${k}[0]" -strip "${TEMP}${f%*.psd}.jpg";
done

##
# template injection
#
find ${HERE} -type f -name "*.html" | while read k; do
    f="${k#*${HERE}}";
    mkdir -p "${TEMP}${f%/*}";
    sed > "${TEMP}${f}" "${k}" \
        -e "/__HEADER__/r ${HERE}/header.fill" \
        -e 's/__HEADER__//g' \
        -e "/__FOOTER__/r ${HERE}/footer.fill" \
        -e 's/__FOOTER__//g' \
        -e "/__INDEPENDENT_SHADE__/r ${HERE}/independent.shade.fill" \
        -e 's/__INDEPENDENT_SHADE__//g' \
        -e "/__INDEPENDENT_WHITE__/r ${HERE}/independent.white.fill" \
        -e 's/__INDEPENDENT_WHITE__//g' \
        ;
done

chown -R 1000:1000 ${TEMP};

#===============================================================
EOF
#===============================================================

##
# static assets
#
cp -R ${HERE}/../assets ${TEMP};

##
#
#
cp ${HERE}/robots.txt ${TEMP};

##
# payload
#
(
    cd ${TEMP};
)

##
# publish
#
rm -fr ${HTML};
mv ${TEMP} ${HTML};