Makefile 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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. @cd website && node update.js
  13. @cd website && ./node_modules/.bin/hexo generate
  14. .PHONY: website-preview
  15. website-preview: website-build
  16. @echo "--> Running preview.."
  17. @cd website && ./node_modules/.bin/hexo server --debug
  18. .PHONY: website-deploy
  19. website-deploy: website-build
  20. @echo "--> Deploying to GitHub pages.."
  21. @mkdir -p /tmp/deploy-$(ghpages_repo)
  22. # Custom steps
  23. @rsync \
  24. --archive \
  25. --delete \
  26. --exclude=.git* \
  27. --exclude=node_modules \
  28. --exclude=lib \
  29. --itemize-changes \
  30. --checksum \
  31. --no-times \
  32. --no-group \
  33. --no-motd \
  34. --no-owner \
  35. ./website/public/ /tmp/deploy-$(ghpages_repo)
  36. @echo 'This branch is just a deploy target. Do not edit. You changes will be lost.' > /tmp/deploy-$(ghpages_repo)/README.md
  37. @cd /tmp/deploy-$(ghpages_repo) \
  38. && git init && git checkout -B $(ghpages_branch) && git add --all . \
  39. && git commit -nm "Update $(ghpages_repo) website by $${USER}" \
  40. && (git remote add origin $(ghpages_url)|| true) \
  41. && git push origin $(ghpages_branch):refs/heads/$(ghpages_branch) --force
  42. @rm -rf /tmp/deploy-$(ghpages_repo)