Makefile 1.5 KB

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