~thirdplace/discovery

ref: d18e4d39dcb9525e912dcd60f216d6bebb6aad4c discovery/contrib/build -rwxr-xr-x 634 bytes
d18e4d39Dag fix 7 months ago
                                                                                
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
#!/bin/bash
set -eu -o pipefail

name="${1:-discovery}"
repo="${2:-./}"

workspace=$(mktemp -d)
git clone "$repo" "$workspace"

# copy over the prod config
cp -v "./config/config.prod.php" "$workspace/config/config.php"
# copy over assets
cp -v ./var/*.php "$workspace/var/"

# lint
find "$workspace" -name '*.php' | xargs -P0 -n1 php -l

# install composer deps
composer install \
    --working-dir="$workspace" \
    --prefer-dist \
    --no-ansi

build="/tmp/${name}-$(date '+%Y-%m-%d_%H-%M-%S').tgz"

tar \
    -czf "$build" \
    --dereference \
    --exclude-vcs \
     -C "$workspace" ./

cp "$build" "/tmp/${name}-latest.tgz"