Skip to content
New issue

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

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

Already on GitHub? # to your account

Incremental deployments #24

Open
johannesjh opened this issue Jan 26, 2014 · 0 comments
Open

Incremental deployments #24

johannesjh opened this issue Jan 26, 2014 · 0 comments

Comments

@johannesjh
Copy link

I want to suggest incremental deployments, i.e., to only transfer differences to the server.

Problem:
In the current implementation, every deployment destroys the remote branche's history and wastes bandwith by uploading the entire site (instead of just uploading the differences). Technically, the ghpages deployment initializes a new git repo, packs the entire generated output into one commit, and force-pushes the branch to the remote. See the file src/ghpages.plugin.coffee.

Suggested improvement:
The ghpages plugin should not destroy history in the remote branch and should push a small, differential commit that contains changes only. I have set up a corresponding deployment shell script as follows.

#!/usr/bin/env bash

# change into the script's directory
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
pushd $DIR > /dev/null

# configuration
OUT=out

# setup a clean git repo in ./out
git fetch --all
git fetch --tags
rm -rf $OUT
mkdir $OUT
cp -r .git $OUT/.git
pushd out > /dev/null
git checkout --track origin/master
git reset --hard origin/master
popd > /dev/null

# deploy to out folder
docpad generate --env static

# commit the out folder's contents
pushd $OUT > /dev/null
git add -A --force
git commit -m "`date`"
git push -f
popd > /dev/null


# change back into the original working directory
popd > /dev/null

Future improvements upon the above script:

  • Some implicit assumptions contained in the above script are that: The website's source and output are managed in the same repository. The source is maintained in a branch src, the output is maintained in branch master.
  • Instead of bash / shellscript, a proper implementation as docpad plugin would be beneficial. But the shell script has proven sufficient for my goals.
# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

3 participants