Skip to content
Browse files

Added optional ref support, defaults to latest tag

  • Loading branch information...
1 parent 443ba6d commit ead4053b662b2560a20be2ee71017ad50fd83911 @tj tj committed Jun 8, 2011
Showing with 12 additions and 9 deletions.
  1. +1 −1 Readme.md
  2. +11 −8 bin/deploy
View
2 Readme.md
@@ -32,7 +32,7 @@
prev[ious] output previous release commit
exec|run <cmd> execute the given <cmd>
list list previous deploy commits
- [ref] deploy to [ref] or HEAD
+ [ref] deploy to [ref], the 'ref' setting, or latest tag
## Configuration
View
19 bin/deploy
@@ -34,7 +34,7 @@ usage() {
prev[ious] output previous release commit
exec|run <cmd> execute the given <cmd>
list list previous deploy commits
- [ref] deploy to [ref] or HEAD
+ [ref] deploy to [ref], the 'ref' setting, or latest tag
EOF
}
@@ -162,7 +162,7 @@ setup() {
}
#
-# Deploy <ref>.
+# Deploy [ref].
#
deploy() {
@@ -178,16 +178,19 @@ deploy() {
test $? -eq 0 || abort 'fetch failed'
# latest tag
- log "fetching latest tag"
- ref=`run "cd $path/source && git for-each-ref refs/tags \
- --sort=-authordate \
- --format='%(refname)' \
- --count=1 | cut -d '/' -f 3"`
- test $? -eq 0 || abort 'failed to determine latest tag'
+ if test -z "$ref"; then
+ log "fetching latest tag"
+ ref=`run "cd $path/source && git for-each-ref refs/tags \
+ --sort=-authordate \
+ --format='%(refname)' \
+ --count=1 | cut -d '/' -f 3"`
+ test $? -eq 0 || abort 'failed to determine latest tag'
+ fi
# reset HEAD
log "resetting HEAD to $ref"
run "cd $path/source && git reset --hard $ref"
+ test $? -eq 0 || abort "git reset failed"
# link current
run "ln -sfn $path/source $path/current"

0 comments on commit ead4053

Please sign in to comment.
Something went wrong with that request. Please try again.