Makefile 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  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: website-install
  11. @echo "--> Building site.."
  12. @npm run build:umd
  13. @cd website && node update.js
  14. @cd website && ./node_modules/.bin/hexo generate
  15. .PHONY: website-preview
  16. website-preview: website-build
  17. @echo "--> Running preview.."
  18. @npm run build:umd
  19. @cd website && ./node_modules/.bin/hexo server
  20. .PHONY: website-deploy
  21. website-deploy: 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) website by $${USER}" \
  42. && (git remote add origin $(ghpages_url)|| true) \
  43. && git push origin $(ghpages_branch):refs/heads/$(ghpages_branch) --force
  44. @rm -rf /tmp/deploy-$(ghpages_repo)