Last active
January 1, 2016 21:09
-
-
Save necolas/8201662 to your computer and use it in GitHub Desktop.
Ghetto git deployment
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BUILD_DIR := ./build | |
STAGING_REPO = ssh://user@hostname/~/staging.example.git | |
PROD_REPO = ssh://user@hostname/~/example.git | |
install: | |
npm install | |
# Deploy tasks | |
staging: build git-staging deploy | |
@ git tag -f staging | |
@ echo "Staging deploy complete" | |
prod: build git-prod deploy | |
@ git tag -f production | |
@ echo "Production deploy complete" | |
# Build tasks | |
build: clean | |
# whatever your build step is | |
# Sub-tasks tasks | |
clean: | |
@ rm -rf $(BUILD_DIR) | |
git-prod: | |
@ cd $(BUILD_DIR) && \ | |
git init && \ | |
git remote add origin $(PROD_REPO) | |
git-staging: | |
@ cd $(BUILD_DIR) && \ | |
git init && \ | |
git remote add origin $(STAGING_REPO) | |
deploy: | |
@ cd $(BUILD_DIR) && \ | |
git add -A && \ | |
git commit -m "Release" && \ | |
git push -f origin +master:refs/heads/master | |
.PHONY: install build clean deploy git-prod git-staging prod staging |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment