Makefile 1.4 KB

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