|
| 1 | +# Notes: |
| 2 | +# - Jobs initially start from /home/circleci/project |
| 3 | +# - Plugin located at /home/circleci/project/wp-graphql-content-blocks |
| 4 | + |
| 5 | +version: 2.1 |
| 6 | + |
| 7 | +orbs: |
| 8 | + |
| 9 | + wp-product-orb: wpengine/[email protected] |
| 10 | + |
| 11 | + |
| 12 | +jobs: |
| 13 | + plugin-unzip: |
| 14 | + executor: wp-product-orb/default |
| 15 | + environment: |
| 16 | + WPE_SESSION_DIR: ./.wpe |
| 17 | + parameters: |
| 18 | + slug: |
| 19 | + type: string |
| 20 | + filename: |
| 21 | + type: string |
| 22 | + steps: |
| 23 | + - attach_workspace: |
| 24 | + at: . |
| 25 | + - wp-product-orb/variable_load |
| 26 | + - run: |
| 27 | + name: "Unzip plugin files" |
| 28 | + command: | |
| 29 | + cd ~/project |
| 30 | + mkdir build |
| 31 | + curl -sL https://github.com/wpengine/wp-graphql-content-blocks/releases/latest/download/wp-graphql-content-blocks.zip > <<parameters.slug>>.zip |
| 32 | + unzip -o -d <<parameters.slug>> <<parameters.slug>>.zip |
| 33 | + ls -laR |
| 34 | + - wp-product-orb/get_version_from_php: |
| 35 | + filename: <<parameters.slug>>/<<parameters.filename>> |
| 36 | + return_var: BUILD_VERSION |
| 37 | + - wp-product-orb/variable: |
| 38 | + var: BUILD_VERSION |
| 39 | + value: $BUILD_VERSION |
| 40 | + - run: |
| 41 | + name: "Move zip file to build directory" |
| 42 | + command: | |
| 43 | + mv <<parameters.slug>>.zip build/<<parameters.slug>>.$BUILD_VERSION.zip |
| 44 | + - run: |
| 45 | + name: "DEBUG" |
| 46 | + command: | |
| 47 | + ls -laR |
| 48 | + - persist_to_workspace: |
| 49 | + root: . |
| 50 | + paths: |
| 51 | + - . |
| 52 | + |
| 53 | + plugin-build-json: |
| 54 | + executor: wp-product-orb/parser |
| 55 | + environment: |
| 56 | + WPE_SESSION_DIR: ./.wpe |
| 57 | + parameters: |
| 58 | + slug: |
| 59 | + type: string |
| 60 | + steps: |
| 61 | + - attach_workspace: |
| 62 | + at: . |
| 63 | + - run: |
| 64 | + command: | |
| 65 | + cd ~/project |
| 66 | + - wp-product-orb/variable_load |
| 67 | + - wp-product-orb/parse_wp_readme: |
| 68 | + infile: <<parameters.slug>>/readme.txt |
| 69 | + outfile: build/<<parameters.slug>>.$BUILD_VERSION.json |
| 70 | + - store_artifacts: |
| 71 | + path: build |
| 72 | + - run: |
| 73 | + name: "DEBUG" |
| 74 | + command: | |
| 75 | + pwd |
| 76 | + ls -laR |
| 77 | + - persist_to_workspace: |
| 78 | + root: . |
| 79 | + paths: |
| 80 | + - build |
| 81 | + |
| 82 | + plugin-deploy: |
| 83 | + executor: wp-product-orb/authenticate |
| 84 | + environment: |
| 85 | + WPE_SESSION_DIR: ./.wpe |
| 86 | + parameters: |
| 87 | + auth_url: |
| 88 | + type: string |
| 89 | + upload_url: |
| 90 | + type: string |
| 91 | + slug: |
| 92 | + type: string |
| 93 | + steps: |
| 94 | + - attach_workspace: |
| 95 | + at: . |
| 96 | + - wp-product-orb/variable_load |
| 97 | + - wp-product-orb/authenticate: |
| 98 | + user: WPE_LDAP_USER |
| 99 | + pass: WPE_LDAP_PASS |
| 100 | + url: <<parameters.auth_url>> |
| 101 | + - run: |
| 102 | + name: "DEBUG" |
| 103 | + command: | |
| 104 | + pwd |
| 105 | + ls -laR |
| 106 | + - wp-product-orb/post_zip: |
| 107 | + url: <<parameters.upload_url>>/<<parameters.slug>> |
| 108 | + zip: build/<<parameters.slug>>.$BUILD_VERSION.zip |
| 109 | + json: build/<<parameters.slug>>.$BUILD_VERSION.json |
| 110 | + version: $BUILD_VERSION |
| 111 | + |
| 112 | +workflows: |
| 113 | + deploy: |
| 114 | + jobs: |
| 115 | + - plugin-unzip: |
| 116 | + slug: wpgraphql-content-blocks |
| 117 | + filename: wp-graphql-content-blocks.php |
| 118 | + # Run this job when a tag is published. |
| 119 | + filters: |
| 120 | + branches: |
| 121 | + ignore: /.*/ |
| 122 | + tags: |
| 123 | + only: /^v.*/ |
| 124 | + - plugin-build-json: |
| 125 | + slug: wpgraphql-content-blocks |
| 126 | + requires: |
| 127 | + - plugin-unzip |
| 128 | + # Run this job when a tag is published. |
| 129 | + filters: |
| 130 | + branches: |
| 131 | + ignore: /.*/ |
| 132 | + tags: |
| 133 | + only: /^v.*/ |
| 134 | + - plugin-deploy: |
| 135 | + name: "plugin-deploy-staging" |
| 136 | + slug: wpgraphql-content-blocks |
| 137 | + requires: |
| 138 | + - plugin-unzip |
| 139 | + - plugin-build-json |
| 140 | + filters: |
| 141 | + branches: |
| 142 | + only: |
| 143 | + - main |
| 144 | + - canary |
| 145 | + tags: |
| 146 | + only: /^v.*/ |
| 147 | + context: wpe-ldap-creds |
| 148 | + auth_url: https://auth-staging.wpengine.io/v1/tokens |
| 149 | + upload_url: https://wp-product-info-staging.wpesvc.net/v1/plugins |
| 150 | + - plugin-deploy: |
| 151 | + name: "plugin-deploy-production" |
| 152 | + slug: wpgraphql-content-blocks |
| 153 | + requires: |
| 154 | + - "plugin-deploy-staging" |
| 155 | + filters: |
| 156 | + branches: |
| 157 | + ignore: /.*/ |
| 158 | + tags: |
| 159 | + # Run this job when a tag is published. |
| 160 | + only: /^v.*/ |
| 161 | + context: wpe-ldap-creds |
| 162 | + auth_url: https://auth.wpengine.io/v1/tokens |
| 163 | + upload_url: https://wp-product-info.wpesvc.net/v1/plugins |
0 commit comments