minafaw3

circleCI flow

Jun 10th, 2020
275
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.49 KB | None | 0 0
  1. version: 2.1
  2.  
  3. executors:
  4. node:
  5. docker:
  6. - image: circleci/node:10.16
  7.  
  8. commands:
  9. flow:
  10. parameters:
  11. environment:
  12. type: string
  13. default: "production"
  14. yarn:
  15. type: string
  16. default: "yarn prod-build"
  17. steps:
  18. - add_ssh_keys:
  19. fingerprints:
  20. - xxx
  21. - store_test_results:
  22. path: test-results
  23. - checkout
  24. - restore_cache:
  25. name: Restore Yarn Package & Packge.json Cache
  26. keys:
  27. - yarn-packages-{{ checksum "yarn.lock" }}
  28. - v1-dependencies-{{ checksum "package.json" }}
  29. - yarn-packages-
  30. - v1-dependencies-
  31. - run:
  32. name: Install Yarn Packages
  33. command: yarn install
  34. - run:
  35. name: Building Repo
  36. command: << parameters.yarn >>
  37. - save_cache:
  38. name: Save Yarn Package Cache
  39. key: dependency-cache-{{ checksum "package.json" }}
  40. paths:
  41. - ./node_modules
  42. - run:
  43. name: Run SSH keyscan
  44. command: ssh-keyscan ${hostname} >> ~/.ssh/known_hosts
  45. - run:
  46. name: Install Rysnc
  47. command: sudo apt-get install rsync
  48. - run:
  49. name: Upload files to theme folder
  50. command: rsync -avP --delete-before --exclude 'node_modules' --exclude '.git'
  51. --exclude 'webpack' --exclude '.circleci' --exclude 'src' --exclude '.babelrc'
  52. --exclude '.browserslistrc' --exclude '.eslintrc' --exclude '.gitignore'
  53. --exclude '.prettierrc' --exclude '.stylelintignore' --exclude '.stylelintrc'
  54. --exclude 'env.json' --exclude 'package.json' --exclude 'yarn.lock' --exclude
  55. 'README.md' ~/<< parameters.environment >>-theme ${username}@${hostname}:/var/www/html/${site_name}/wp-content/themes/
  56.  
  57.  
  58. jobs:
  59. production:
  60. executor: node
  61. working_directory: ~/production-theme
  62. steps:
  63. - flow:
  64. - environment: "production"
  65. - yarn: "yarn prod-build"
  66.  
  67.  
  68. development:
  69. working_directory: ~/develop-theme
  70. docker:
  71. - image: circleci/node:10.16
  72. steps:
  73. - flow:
  74. - environment: "develop"
  75. - yarn: "yarn test-build"
  76.  
  77. workflows:
  78. version: 2
  79. production_and_development:
  80. jobs:
  81. - development:
  82. filters:
  83. branches:
  84. only: develop
  85. - production:
  86. filters:
  87. branches:
  88. only: master
Add Comment
Please, Sign In to add comment