Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make it possible for contributors to run deploy.sh before sending PRs #699

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 20 additions & 2 deletions deploy.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
#!/bin/bash
set -e # exit with nonzero exit code if anything fails

# These variables are set by CI builds.
if [ ! -n "$GH_TOKEN" ] && [ ! -n "$GH_REF" ]; then
# Assume a test build, pushing to a contoributor's forked repository
myorigin=$(git config --get remote.origin.url)
mydir=$(dirname $(realpath $0))
export PATH="${mydir}/node_modules/.bin:${PATH}"
fi

# VOLUMIO THEME
# clear and re-create the dist directory
rm -rf dist || exit 0;
Expand All @@ -25,7 +33,12 @@ git add .
git commit -m "Deploy to Dist Branch"

# Force push from the current repo's master branch to the dist branch for deployment
git push --force --quiet "https://${GH_TOKEN}@${GH_REF}" master:dist > /dev/null 2>&1
if [ -n "$myorigin" ]; then
git remote add origin "$myorigin"
git push --force origin master:dist
else
git push --force --quiet "https://${GH_TOKEN}@${GH_REF}" master:dist > /dev/null 2>&1
fi

cd ..
# VOLUMIO3 THEME
Expand All @@ -52,4 +65,9 @@ git add .
git commit -m "Deploy to Dist3 Branch"

# Force push from the current repo's master branch to the dist branch for deployment
git push --force --quiet "https://${GH_TOKEN}@${GH_REF}" master:dist3 > /dev/null 2>&1
if [ -n "$myorigin" ]; then
git remote add origin "$myorigin"
git push --force origin master:dist3
else
git push --force --quiet "https://${GH_TOKEN}@${GH_REF}" master:dist3 > /dev/null 2>&1
fi