Move all files to sculpin/
This commit is contained in:
parent
c5d71803a5
commit
0f61b4e9ee
1514 changed files with 0 additions and 0 deletions
114
sculpin/run.local
Executable file
114
sculpin/run.local
Executable file
|
@ -0,0 +1,114 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
function ci:build {
|
||||
APP_ENV=prod nix develop --command ./run generate
|
||||
}
|
||||
|
||||
function ci:install {
|
||||
nix develop --command composer install
|
||||
}
|
||||
|
||||
function ci:test {
|
||||
nix develop --command ./run test --testdox --colors=always
|
||||
}
|
||||
|
||||
function clean {
|
||||
rm -fr output_*/ source/build/
|
||||
}
|
||||
|
||||
# Create a new daily email.
|
||||
function create-daily {
|
||||
local date="${1}"
|
||||
local title="${2}"
|
||||
|
||||
if [ "${date}" == "next" ]; then
|
||||
next_date=$(ls -1 source/_daily_emails | tail -n 1 | tr -d '.md' | xargs -I {} date +%Y-%m-%d -d '{} +1 day')
|
||||
else
|
||||
next_date="${date}"
|
||||
fi
|
||||
|
||||
filepath="source/_daily_emails/${next_date}.md"
|
||||
|
||||
shift 1
|
||||
|
||||
# Generate the title and slug.
|
||||
title="${*}"
|
||||
slug=$(echo "${title}" | \
|
||||
tr '[:upper:]' '[:lower:]' | \
|
||||
sed 's/[^a-z0-9]/-/g' | \
|
||||
sed 's/\-\-+/-/g' | \
|
||||
sed 's/^\-//;s/\-$//')
|
||||
|
||||
# Create the file.
|
||||
cp -f --no-clobber resources/daily-email-stub.md "${filepath}"
|
||||
|
||||
date=$(date -d "${next_date}" +%Y-%m-%d)
|
||||
day=$(date -d "${next_date}" +%d)
|
||||
month=$(date -d "${next_date}" +%m)
|
||||
year=$(date -d "${next_date}" +%Y)
|
||||
|
||||
# Replace the placeholders.
|
||||
sed -i "s/{{ date }}/${date}/" "${filepath}"
|
||||
sed -i "s/{{ title }}/${title}/" "${filepath}"
|
||||
sed -i "s#{{ permalink }}#daily/${year}/${month}/${day}/${slug}#" "${filepath}"
|
||||
|
||||
# Create a commit with the appropriate date in the message
|
||||
git add "${filepath}"
|
||||
git commit --quiet -m "Add daily email for $(date -d "${next_date}" +%d/%m/%y)"
|
||||
|
||||
echo "${filepath}"
|
||||
}
|
||||
|
||||
# Build CSS assets, this is meant to be run within the `assets` directory.
|
||||
function npm:build:css {
|
||||
local args=()
|
||||
|
||||
if [[ "${NODE_ENV:-}" == "production" ]]; then
|
||||
args=(--minify)
|
||||
else
|
||||
args=(--watch)
|
||||
fi
|
||||
|
||||
cd assets || exit
|
||||
|
||||
tailwindcss \
|
||||
--config tailwind.config.ts \
|
||||
--input css/tailwind.css \
|
||||
--output ../source/build/tailwind.css "${args[@]}"
|
||||
}
|
||||
|
||||
function setup {
|
||||
git submodule update --recursive --init
|
||||
git submodule update --recursive --remote || true
|
||||
|
||||
composer install
|
||||
(cd assets && pnpm install)
|
||||
|
||||
(cd assets && NODE_ENV=production npm:build:css)
|
||||
APP_ENV=prod generate
|
||||
}
|
||||
|
||||
function publish {
|
||||
git push
|
||||
|
||||
tag-release
|
||||
git push --tags
|
||||
|
||||
git stash
|
||||
clean
|
||||
|
||||
# export NODE_ENV=production
|
||||
# (cd assets && npm:build:css)
|
||||
APP_ENV=prod generate
|
||||
|
||||
rsync --archive --verbose --compress --update --delete \
|
||||
output_prod/ ssh.oliverdavies.uk:/var/www/vhosts/website-sculpin
|
||||
|
||||
git stash pop
|
||||
}
|
||||
|
||||
function test {
|
||||
phpunit "${@}"
|
||||
}
|
||||
|
||||
# vim: ft=bash
|
Loading…
Add table
Add a link
Reference in a new issue