diff --git a/Procfile b/Procfile index 702f0bbd..b9373c7a 100644 --- a/Procfile +++ b/Procfile @@ -1,2 +1 @@ -web: vendor/bin/heroku-php-apache2 public/ -heroku-postbuild: npm run production \ No newline at end of file +web: vendor/bin/heroku-php-apache2 public/ && npm run production \ No newline at end of file diff --git a/build/deploy.sh b/build/deploy.sh new file mode 100644 index 00000000..75056c67 --- /dev/null +++ b/build/deploy.sh @@ -0,0 +1,35 @@ +# Save latest Git commit message +MESSAGE=$(git log -1 --pretty=%B) + +# Add it as a secret variable on CI environment +git remote set-url origin $REMOTE_REPOSITORY +git config user.email $DEPLOY_GIT_EMAIL +git config user.name $DEPLOY_GIT_USERNAME + +if git ls-remote $REMOTE_REPOSITORY | grep -sw "deploy" 2>&1>/dev/null; then + git checkout . && git checkout deploy; +else + git checkout --orphan deploy; +fi + +# Remove all files except .git, node_modules and vendor folder +find . -path ./.git -prune -o \( \! -path ./dist \) -prune -o \( \! -path ./vendor \) -exec rm -rf {} \; 2> /dev/null +# Add master branch files +git archive master | tar x -C . + +# Generate i18n string for the front-end +composer install -n --prefer-dist +php artisan vue-i18n:generate + +# Compile front-end stuff +yarn --pure-lockfile +yarn production + +# Those files are ignored on master branch, force add it +git add -f public/css +git add -f public/js + +# Push to the deploy branch +git add . +git commit -am "[${CI_COMMIT_SHA:0:8}]: $MESSAGE" +git push -u origin deploy \ No newline at end of file