Makefile 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. SHELL := /usr/bin/env bash
  2. ghpages_repo := "transloadit/uppy"
  3. ghpages_branch := "gh-pages"
  4. .PHONY: pull
  5. pull:
  6. @echo "--> Running pull.."
  7. @git pull
  8. .PHONY: website-install
  9. website-install:
  10. @echo "--> Installing dependencies.."
  11. @cd website && npm install
  12. .PHONY: website-build
  13. website-build:
  14. @echo "--> Building site.."
  15. @cd website && ./node_modules/.bin/hexo generate
  16. .PHONY: website-preview
  17. website-preview: website-install website-build
  18. @echo "--> Running preview.."
  19. @cd website && ./node_modules/.bin/hexo server
  20. .PHONY: website-deploy
  21. website-deploy: pull website-build
  22. @echo "--> Deploying to GitHub pages.."
  23. @mkdir -p /tmp/deploy-$(ghpages_repo)
  24. # Custom steps
  25. @rsync \
  26. --archive \
  27. --delete \
  28. --exclude=.git* \
  29. --exclude=node_modules \
  30. --exclude=lib \
  31. --itemize-changes \
  32. --checksum \
  33. --no-times \
  34. --no-group \
  35. --no-motd \
  36. --no-owner \
  37. ./website/public/ /tmp/deploy-$(ghpages_repo)
  38. @echo 'This branch is just a deploy target. Do not edit. You changes will be lost.' > /tmp/deploy-$(ghpages_repo)/README.md
  39. @cd /tmp/deploy-$(ghpages_repo) \
  40. && git init && git checkout -B $(ghpages_branch) && git add --all . \
  41. && git commit -nm "Update $(ghpages_repo) _site by $${USER}" \
  42. && (git remote add origin git@github.com:$(ghpages_repo).git || true) \
  43. && git push origin $(ghpages_branch):refs/heads/$(ghpages_branch) --force
  44. @rm -rf /tmp/deploy-$(ghpages_repo)