Statically generated site for Redbrick https://www.redbrick.dcu.ie
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

83 lines
2.0 KiB

  1. ---
  2. version: 2
  3. jobs:
  4. build:
  5. working_directory: ~/static-site
  6. docker:
  7. - image: node:8
  8. steps:
  9. - checkout
  10. - restore_cache:
  11. key: dependency-cache-{{ checksum "yarn.lock" }}
  12. - run:
  13. name: Install Dep
  14. command: yarn
  15. - save_cache:
  16. key: dependency-cache-{{ checksum "yarn.lock" }}
  17. paths:
  18. - node_modules
  19. - run:
  20. name: Build Site
  21. command: |
  22. set -eo pipefail
  23. yarn generate
  24. - run:
  25. name: Get Cache Checksum
  26. command: ls -lnR source > deps_checksum
  27. - save_cache:
  28. key: build-cache-{{ .Branch }}-{{ checksum "deps_checksum" }}
  29. paths:
  30. - public
  31. test:
  32. docker:
  33. - image: 18fgsa/html-proofer
  34. environment:
  35. ENV: CI
  36. working_directory: ~/static-site
  37. steps:
  38. - checkout
  39. - run:
  40. name: Get Cache Checksum
  41. command: ls -lnR source > deps_checksum
  42. - restore_cache:
  43. keys:
  44. - build-cache-{{ .Branch }}-{{ checksum "deps_checksum" }}
  45. - build-cache-{{ .Branch }}
  46. - run:
  47. name: Test Internal Links
  48. command: |
  49. set -eo pipefail
  50. htmlproofer --allow-hash-href --check-html --empty-alt-ignore \
  51. --disable-external ~/static-site/public
  52. - store_artifacts:
  53. path: results.txt
  54. prefix: tests
  55. - store_test_results:
  56. path: "results.txt"
  57. deploy:
  58. docker:
  59. - image: alpine
  60. steps:
  61. - run:
  62. name: Install Curl
  63. command: apk add --no-cache curl
  64. - run:
  65. name: Trigger Regeneration
  66. command: curl https://www.redbrick.dcu.ie/api/regenerate?token=$KEY
  67. workflows:
  68. version: 2
  69. build-test-and-deploy:
  70. jobs:
  71. - build
  72. - test:
  73. requires:
  74. - build
  75. - deploy:
  76. requires:
  77. - build
  78. filters:
  79. branches:
  80. only:
  81. - master