deployment-dcdn/assets/webhook.sh

19 lines
594 B
Bash
Raw Permalink Normal View History

2024-02-25 19:17:44 +01:00
#!/bin/bash
2024-05-02 23:54:06 +02:00
hook_origin=$1
repo_name=$(ls /var/www/repositories/ | grep -v '^cms')
2024-04-16 16:03:33 +02:00
cd /var/www/repositories/$repo_name
2024-05-02 23:54:06 +02:00
echo "Trigger : ${hook_origin}"
if [[ "$hook_origin" == "git" ]]; then
git pull origin prod
fi
2024-04-16 16:03:33 +02:00
jq '.scripts |= with_entries(.value |= gsub("\\bnuxt \\b"; "./node_modules/nuxt/bin/nuxt.mjs "))' package.json > temp.json && mv temp.json package.json
2024-05-02 23:54:06 +02:00
node --max-old-space-size=250 `which npm` install -y
node --max-old-space-size=250 `which npm` run generate --prerender
2024-04-16 16:03:33 +02:00
2024-05-02 23:54:06 +02:00
rm -r /var/www/html/public
cp -r "/var/www/repositories/${repo_name}/.output/public" /var/www/html