├── .gitignore ├── assets ├── css │ └── admin.css └── images │ ├── cover.png │ ├── deploy-buddy-logo.svg │ └── logo.svg ├── buddy-deploy.php ├── composer.json ├── composer.lock ├── index.php ├── languages ├── deploy-buddy-en_US.mo └── deploy-buddy-en_US.po ├── package-lock.json ├── package.json ├── readme.md ├── readme.txt ├── src ├── AutomaticDeploy.php ├── BuddyIntegration.php ├── Config.php ├── ContextHelp.php ├── ManualDeploy.php ├── Notice.js ├── SaveButton.js ├── Settings.php ├── admin.js ├── admin.scss ├── functions.php └── index.js ├── templates ├── automatic_deploy.php ├── configuration.php ├── footer.php ├── header.php ├── installation.php └── manual_deploy.php └── webpack.config.js /.gitignore: -------------------------------------------------------------------------------- 1 | vendor 2 | node_modules 3 | build 4 | -------------------------------------------------------------------------------- /assets/css/admin.css: -------------------------------------------------------------------------------- 1 | :root { 2 | --color-white: #ffffff; 3 | --color-blue-1: #004DFF; 4 | --color-blue-2: #1A86FD; 5 | --color-blue-3: #0DA7FE; 6 | --color-blue-4: #05BBFF; 7 | --color-blue-5: #00C9FF; 8 | --color-orange: #FFA500; 9 | --color-light: #E6EDFF; 10 | --color-black: #000000; 11 | } 12 | 13 | .buddy-header { 14 | background-color: var(--color-white); 15 | padding: 20px 30px; 16 | width: calc(100% - 80px); 17 | box-shadow: 0 1px 1px rgb(0 0 0 / 4%); 18 | margin-top: 20px; 19 | align-self: center; 20 | align-items: center; 21 | } 22 | 23 | @media screen and (max-width: 660px) { 24 | .buddy-header { 25 | justify-items: center; 26 | } 27 | } 28 | 29 | .buddy-header nav { 30 | justify-self: end; 31 | text-align: right; 32 | font-size: 16px; 33 | font-weight: 700; 34 | } 35 | 36 | @media screen and (max-width: 660px) { 37 | .buddy-header nav { 38 | justify-self: center; 39 | text-align: center; 40 | margin-top: 1em; 41 | border-top: 1px solid var(--color-light); 42 | width: 100%; 43 | } 44 | } 45 | 46 | .buddy-header nav ul { 47 | display: flex; 48 | flex-direction: row; 49 | flex-wrap: nowrap; 50 | } 51 | 52 | @media screen and (max-width: 660px) { 53 | .buddy-header nav ul { 54 | justify-content: center; 55 | } 56 | } 57 | 58 | .buddy-header nav ul li { 59 | margin-left: 30px; 60 | margin-bottom: 0; 61 | } 62 | 63 | @media screen and (max-width: 660px) { 64 | .buddy-header nav ul li { 65 | margin-left: 15px; 66 | margin-right: 15px; 67 | } 68 | } 69 | 70 | .buddy-header nav ul li a { 71 | text-decoration: none; 72 | color: var(--color-black); 73 | transition: all 0.2s linear; 74 | } 75 | 76 | .buddy-logo { 77 | display: block; 78 | line-height: 0; 79 | } 80 | 81 | .buddy-logo img { 82 | height: 45px; 83 | } 84 | 85 | .buddy-header nav ul li a:hover, 86 | .buddy-header nav ul li a:focus { 87 | color: var(--color-blue-2); 88 | } 89 | 90 | @media screen and (max-width: 660px) { 91 | .buddy-header nav { 92 | text-align: left; 93 | } 94 | } 95 | 96 | .buddy-grid { 97 | display: grid; 98 | } 99 | 100 | .grid-columns-1 { 101 | grid-template-columns: repeat(1, 1fr); 102 | } 103 | 104 | .grid-columns-2 { 105 | grid-template-columns: repeat(2, 1fr); 106 | } 107 | 108 | @media screen and (max-width: 1024px) { 109 | .grid-columns-2 { 110 | grid-template-columns: repeat(2, 1fr); 111 | } 112 | } 113 | 114 | @media screen and (max-width: 660px) { 115 | .grid-columns-2 { 116 | grid-template-columns: repeat(1, 1fr); 117 | } 118 | } 119 | 120 | .grid-columns-3 { 121 | grid-template-columns: repeat(3, 1fr); 122 | } 123 | 124 | @media screen and (max-width: 1024px) { 125 | .grid-columns-3 { 126 | grid-template-columns: repeat(1, 1fr); 127 | } 128 | } 129 | 130 | @media screen and (max-width: 660px) { 131 | .grid-columns-3 { 132 | grid-template-columns: repeat(1, 1fr); 133 | } 134 | } 135 | 136 | .grid-columns-4 { 137 | grid-template-columns: repeat(4, 1fr); 138 | } 139 | 140 | @media screen and (max-width: 1024px) { 141 | .grid-columns-4 { 142 | grid-template-columns: repeat(2, 1fr); 143 | } 144 | } 145 | 146 | @media screen and (max-width: 660px) { 147 | .grid-columns-4 { 148 | grid-template-columns: repeat(1, 1fr); 149 | } 150 | } 151 | 152 | .buddy-wrapper { 153 | padding: 40px; 154 | background-color: var(--color-white); 155 | box-shadow: 0 1px 1px rgb(0 0 0 / 4%); 156 | margin: 30px .5em; 157 | } 158 | 159 | .buddy-wrapper h3.cmb2-metabox-title { 160 | font-size: 1.3em; 161 | margin-top: 30px; 162 | } 163 | 164 | .buddy-wrapper .cmb-type-title { 165 | border-bottom:#ccc 1px solid; 166 | } 167 | -------------------------------------------------------------------------------- /assets/images/cover.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/palmiak/deploy-buddy/0fb7e653de3d35c86afa42318ca8fed516450317/assets/images/cover.png -------------------------------------------------------------------------------- /assets/images/deploy-buddy-logo.svg: -------------------------------------------------------------------------------- 1 | 31 | -------------------------------------------------------------------------------- /assets/images/logo.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /buddy-deploy.php: -------------------------------------------------------------------------------- 1 | '1.3.4', 24 | 'file_path' => __FILE__, 25 | 'dir' => __DIR__, 26 | 'base_name' => plugin_basename( __FILE__ ), 27 | 'plugin_url' => plugin_dir_url( __FILE__ ), 28 | 'slug' => 'deploy-buddy', 29 | 'language_slug' => 'deploy-buddy', 30 | 'name' => 'Deploy Buddy', 31 | 'shortname' => 'Deploy Buddy', 32 | 'utm' => 'https://buddy.works/?utm_medium=referral&utm_campaign=deploy_buddy_plugin', 33 | 'settings_version' => get_option( 'buddy_options_version' ), 34 | 'webhook' => options_helper( 'buddy_webhook', false ), 35 | 'add_to_topbar' => options_helper( 'buddy_topbar', true, ), 36 | 'manual_deploy_capabilities' => options_helper( 'buddy_manual_deploy_capabilities', 'manage_options' ), 37 | 'manual_deploy' => options_helper( 'buddy_manual_deploy', true ), 38 | 'automatic_deploy' => options_helper( 'buddy_automatic_deploy', false ), 39 | 'automatic_deploy_post_types' => options_helper( 'buddy_automatic_deploy_post_types', array( 'post', 'page' ) ), 40 | 'automatic_deploy_capabilities' => options_helper( 'buddy_automatic_deploy_capabilities', 'manage_options' ), 41 | 'capabilities_options' => options_helper( 'buddy_capabilities_options', 'manage_options' ), 42 | ) 43 | ); 44 | 45 | add_action( 'init', __NAMESPACE__ . '\\load_text_domain', 10, 0 ); 46 | 47 | if ( ! requirements_met() ) { 48 | add_action( 'admin_notices', __NAMESPACE__ . '\\print_requirements_notice', 0, 0 ); 49 | } 50 | register_activation_hook( __FILE__, __NAMESPACE__ . '\\activate' ); 51 | register_deactivation_hook( __FILE__, __NAMESPACE__ . '\\deactivate' ); 52 | register_uninstall_hook( __FILE__, __NAMESPACE__ . '\\uninstall' ); 53 | add_action( 'plugins_loaded', __NAMESPACE__ . '\\boot', 10, 0 ); 54 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "buddy/deploy-buddy", 3 | "description": "Seamlessly trigger Buddy.works deploys from WordPress.", 4 | "type": "wordpress-plugin", 5 | "license": "MIT", 6 | "repositories": [ 7 | { 8 | "type": "vcs", 9 | "url": "https://github.com/fumikito/wp-readme" 10 | } 11 | ], 12 | "authors": [ 13 | { 14 | "name": "Maciej Palmowski", 15 | "email": "m.palmowski@freshpixels.pl" 16 | } 17 | ], 18 | "require": { 19 | "composer/installers": "^1.11", 20 | "cmb2/cmb2": "dev-master" 21 | }, 22 | "require-dev": { 23 | "fumikito/wp-readme": "dev-master" 24 | }, 25 | "autoload": { 26 | "psr-4": { 27 | "BuddyIntegration\\":"src/" 28 | }, 29 | "files": [ 30 | "vendor/cmb2/init.php", 31 | "src/functions.php" 32 | ] 33 | }, 34 | "extra": { 35 | "installer-paths": { 36 | "vendor/{$name}/": ["cmb2/cmb2"] 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /composer.lock: -------------------------------------------------------------------------------- 1 | { 2 | "_readme": [ 3 | "This file locks the dependencies of your project to a known state", 4 | "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", 5 | "This file is @generated automatically" 6 | ], 7 | "content-hash": "dbc7d77618ea19f4f0b0b3e5290c2023", 8 | "packages": [ 9 | { 10 | "name": "cmb2/cmb2", 11 | "version": "dev-master", 12 | "source": { 13 | "type": "git", 14 | "url": "https://github.com/CMB2/CMB2.git", 15 | "reference": "cacbc8cedbfdf8ffe0e840858e6860f9333c33f2" 16 | }, 17 | "dist": { 18 | "type": "zip", 19 | "url": "https://api.github.com/repos/CMB2/CMB2/zipball/cacbc8cedbfdf8ffe0e840858e6860f9333c33f2", 20 | "reference": "cacbc8cedbfdf8ffe0e840858e6860f9333c33f2", 21 | "shasum": "" 22 | }, 23 | "require": { 24 | "php": ">5.2.4" 25 | }, 26 | "require-dev": { 27 | "apigen/apigen": "4.1.2", 28 | "awesomemotive/am-cli-tools": ">=1.3.1", 29 | "nette/utils": "2.5.3", 30 | "phpunit/phpunit": "6.5.13" 31 | }, 32 | "suggest": { 33 | "composer/installers": "~1.0" 34 | }, 35 | "type": "wordpress-plugin", 36 | "notification-url": "https://packagist.org/downloads/", 37 | "license": [ 38 | "GPL-2.0-or-later" 39 | ], 40 | "authors": [ 41 | { 42 | "name": "Justin Sternberg", 43 | "email": "justin@dsgnwrks.pro", 44 | "homepage": "https://dsgnwrks.pro", 45 | "role": "Developer" 46 | }, 47 | { 48 | "name": "WebDevStudios", 49 | "email": "contact@webdevstudios.com", 50 | "homepage": "https://github.com/WebDevStudios", 51 | "role": "Developer" 52 | } 53 | ], 54 | "description": "CMB2 is a metabox, custom fields, and forms library for WordPress that will blow your mind.", 55 | "homepage": "https://github.com/CMB2/CMB2", 56 | "keywords": [ 57 | "metabox", 58 | "plugin", 59 | "wordpress" 60 | ], 61 | "support": { 62 | "issues": "https://github.com/CMB2/CMB2/issues", 63 | "source": "http://wordpress.org/support/plugin/cmb2" 64 | }, 65 | "time": "2021-03-04T02:18:53+00:00" 66 | }, 67 | { 68 | "name": "composer/installers", 69 | "version": "v1.11.0", 70 | "source": { 71 | "type": "git", 72 | "url": "https://github.com/composer/installers.git", 73 | "reference": "ae03311f45dfe194412081526be2e003960df74b" 74 | }, 75 | "dist": { 76 | "type": "zip", 77 | "url": "https://api.github.com/repos/composer/installers/zipball/ae03311f45dfe194412081526be2e003960df74b", 78 | "reference": "ae03311f45dfe194412081526be2e003960df74b", 79 | "shasum": "" 80 | }, 81 | "require": { 82 | "composer-plugin-api": "^1.0 || ^2.0" 83 | }, 84 | "replace": { 85 | "roundcube/plugin-installer": "*", 86 | "shama/baton": "*" 87 | }, 88 | "require-dev": { 89 | "composer/composer": "1.6.* || ^2.0", 90 | "composer/semver": "^1 || ^3", 91 | "phpstan/phpstan": "^0.12.55", 92 | "phpstan/phpstan-phpunit": "^0.12.16", 93 | "symfony/phpunit-bridge": "^4.2 || ^5", 94 | "symfony/process": "^2.3" 95 | }, 96 | "type": "composer-plugin", 97 | "extra": { 98 | "class": "Composer\\Installers\\Plugin", 99 | "branch-alias": { 100 | "dev-main": "1.x-dev" 101 | } 102 | }, 103 | "autoload": { 104 | "psr-4": { 105 | "Composer\\Installers\\": "src/Composer/Installers" 106 | } 107 | }, 108 | "notification-url": "https://packagist.org/downloads/", 109 | "license": [ 110 | "MIT" 111 | ], 112 | "authors": [ 113 | { 114 | "name": "Kyle Robinson Young", 115 | "email": "kyle@dontkry.com", 116 | "homepage": "https://github.com/shama" 117 | } 118 | ], 119 | "description": "A multi-framework Composer library installer", 120 | "homepage": "https://composer.github.io/installers/", 121 | "keywords": [ 122 | "Craft", 123 | "Dolibarr", 124 | "Eliasis", 125 | "Hurad", 126 | "ImageCMS", 127 | "Kanboard", 128 | "Lan Management System", 129 | "MODX Evo", 130 | "MantisBT", 131 | "Mautic", 132 | "Maya", 133 | "OXID", 134 | "Plentymarkets", 135 | "Porto", 136 | "RadPHP", 137 | "SMF", 138 | "Starbug", 139 | "Thelia", 140 | "Whmcs", 141 | "WolfCMS", 142 | "agl", 143 | "aimeos", 144 | "annotatecms", 145 | "attogram", 146 | "bitrix", 147 | "cakephp", 148 | "chef", 149 | "cockpit", 150 | "codeigniter", 151 | "concrete5", 152 | "croogo", 153 | "dokuwiki", 154 | "drupal", 155 | "eZ Platform", 156 | "elgg", 157 | "expressionengine", 158 | "fuelphp", 159 | "grav", 160 | "installer", 161 | "itop", 162 | "joomla", 163 | "known", 164 | "kohana", 165 | "laravel", 166 | "lavalite", 167 | "lithium", 168 | "magento", 169 | "majima", 170 | "mako", 171 | "mediawiki", 172 | "miaoxing", 173 | "modulework", 174 | "modx", 175 | "moodle", 176 | "osclass", 177 | "phpbb", 178 | "piwik", 179 | "ppi", 180 | "processwire", 181 | "puppet", 182 | "pxcms", 183 | "reindex", 184 | "roundcube", 185 | "shopware", 186 | "silverstripe", 187 | "sydes", 188 | "sylius", 189 | "symfony", 190 | "tastyigniter", 191 | "typo3", 192 | "wordpress", 193 | "yawik", 194 | "zend", 195 | "zikula" 196 | ], 197 | "support": { 198 | "issues": "https://github.com/composer/installers/issues", 199 | "source": "https://github.com/composer/installers/tree/v1.11.0" 200 | }, 201 | "funding": [ 202 | { 203 | "url": "https://packagist.com", 204 | "type": "custom" 205 | }, 206 | { 207 | "url": "https://github.com/composer", 208 | "type": "github" 209 | }, 210 | { 211 | "url": "https://tidelift.com/funding/github/packagist/composer/composer", 212 | "type": "tidelift" 213 | } 214 | ], 215 | "time": "2021-04-28T06:42:17+00:00" 216 | } 217 | ], 218 | "packages-dev": [ 219 | { 220 | "name": "fumikito/wp-readme", 221 | "version": "dev-master", 222 | "source": { 223 | "type": "git", 224 | "url": "https://github.com/fumikito/wp-readme.git", 225 | "reference": "686b2027e8a612444fdc275ae59aa659b198ff93" 226 | }, 227 | "dist": { 228 | "type": "zip", 229 | "url": "https://api.github.com/repos/fumikito/wp-readme/zipball/686b2027e8a612444fdc275ae59aa659b198ff93", 230 | "reference": "686b2027e8a612444fdc275ae59aa659b198ff93", 231 | "shasum": "" 232 | }, 233 | "require-dev": { 234 | "phpunit/phpunit": "^6.5" 235 | }, 236 | "default-branch": true, 237 | "type": "library", 238 | "scripts": { 239 | "test": [ 240 | "phpunit" 241 | ] 242 | }, 243 | "license": [ 244 | "MIT" 245 | ], 246 | "authors": [ 247 | { 248 | "name": "fumikito", 249 | "email": "guy@hametuha.com" 250 | } 251 | ], 252 | "description": "Generate readme.txt from Github's README.md", 253 | "support": { 254 | "source": "https://github.com/fumikito/wp-readme/tree/master", 255 | "issues": "https://github.com/fumikito/wp-readme/issues" 256 | }, 257 | "time": "2019-07-20T15:14:05+00:00" 258 | } 259 | ], 260 | "aliases": [], 261 | "minimum-stability": "stable", 262 | "stability-flags": { 263 | "cmb2/cmb2": 20, 264 | "fumikito/wp-readme": 20 265 | }, 266 | "prefer-stable": false, 267 | "prefer-lowest": false, 268 | "platform": [], 269 | "platform-dev": [], 270 | "plugin-api-version": "2.0.0" 271 | } 272 | -------------------------------------------------------------------------------- /index.php: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/palmiak/deploy-buddy/0fb7e653de3d35c86afa42318ca8fed516450317/index.php -------------------------------------------------------------------------------- /languages/deploy-buddy-en_US.mo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/palmiak/deploy-buddy/0fb7e653de3d35c86afa42318ca8fed516450317/languages/deploy-buddy-en_US.mo -------------------------------------------------------------------------------- /languages/deploy-buddy-en_US.po: -------------------------------------------------------------------------------- 1 | msgid "" 2 | msgstr "" 3 | "Project-Id-Version: \n" 4 | "POT-Creation-Date: 2021-06-26 12:48+0200\n" 5 | "PO-Revision-Date: 2021-06-26 12:48+0200\n" 6 | "Last-Translator: \n" 7 | "Language-Team: \n" 8 | "Language: en_US\n" 9 | "MIME-Version: 1.0\n" 10 | "Content-Type: text/plain; charset=UTF-8\n" 11 | "Content-Transfer-Encoding: 8bit\n" 12 | "X-Generator: Poedit 3.0\n" 13 | "X-Poedit-Basepath: ..\n" 14 | "Plural-Forms: nplurals=2; plural=(n != 1);\n" 15 | "X-Poedit-KeywordsList: __;_e\n" 16 | "X-Poedit-SearchPath-0: .\n" 17 | "X-Poedit-SearchPathExcluded-0: .git\n" 18 | "X-Poedit-SearchPathExcluded-1: vendor\n" 19 | 20 | #: src/ManualDeploy.php:14 21 | msgid "Deploy Buddy" 22 | msgstr "" 23 | 24 | #: src/ManualDeploy.php:42 25 | msgid "Are you sure that you want to trigger a deployment?" 26 | msgstr "" 27 | 28 | #: src/ManualDeploy.php:47 29 | msgid "Deployment triggered succesfully." 30 | msgstr "" 31 | 32 | #: src/Settings.php:48 33 | msgid "Installation" 34 | msgstr "" 35 | 36 | #: src/Settings.php:54 37 | msgid "Manual Deploy" 38 | msgstr "" 39 | 40 | #: src/Settings.php:61 41 | msgid "Automatic Deploy" 42 | msgstr "" 43 | 44 | #: src/Settings.php:70 src/Settings.php:76 45 | msgid "You are not allowed to view this page" 46 | msgstr "" 47 | 48 | #: templates/automatic_deploy.php:7 49 | msgid "Automatic Deployments" 50 | msgstr "" 51 | 52 | #: templates/automatic_deploy.php:9 53 | #, php-format 54 | msgid "" 55 | "
Each time a member with at least %s capability will save "
56 | "or update a post from this post types:
%s
the "
57 | "auto deploy will run."
58 | msgstr ""
59 |
60 | #: templates/automatic_deploy.php:11
61 | msgid ""
62 | "
If you want to change the capability needed to trigger the auto deploy, "
63 | "add buddy_automatic_deploy_capabilities
constant to wp-config."
64 | "php file."
65 | msgstr ""
66 |
67 | #: templates/automatic_deploy.php:13
68 | msgid ""
69 | "
If you want to change the post types, add "
70 | "buddy_automatic_deploy_post_types
constant to wp-config.php "
71 | "file."
72 | msgstr ""
73 |
74 | #: templates/header.php:11
75 | msgid "Try Buddy"
76 | msgstr ""
77 |
78 | #: templates/header.php:12
79 | msgid "Report an issue"
80 | msgstr ""
81 |
82 | #: templates/installation.php:6
83 | msgid "Installation and usage"
84 | msgstr ""
85 |
86 | #: templates/installation.php:8
87 | msgid "Get your webhook url"
88 | msgstr ""
89 |
90 | #: templates/installation.php:12
91 | msgid ""
92 | "
Currently the plugin is only configurable by constants that you can set "
108 | "in your wp-config.php
file.
The only required constant is the buddy_webhook
, where you "
111 | "have to paste the webhook URL.
define( 'buddy_webhook', PASTE_URL_HERE );
"
114 | msgstr ""
115 |
116 | #: templates/installation.php:34
117 | msgid "Other constants"
118 | msgstr ""
119 |
120 | #: templates/installation.php:37
121 | msgid ""
122 | "buddy_topbar
- default: true - adds the deploy button to the "
123 | "admin bar
buddy_capabilities
- default: manage_options - "
125 | "capability that is needed to see the deploy button
buddy_automatic_deploy
- default: false - turn on or off "
127 | "automatic deployments on post update.
buddy_automatic_deploy_post_types
- default: ['post', "
129 | "'page'] - sets on which post types does the update triggers the auto deploy."
130 | "
buddy_automatic_deploy_capabilities
- default: "
132 | "manage_options - capability that is need to run the auto deploy.
By pressing the deploy button you will trigger the " 143 | "endpoint you selected.
" 144 | msgstr "" 145 | 146 | #: templates/manual_deploy.php:12 147 | msgid "Deploy" 148 | msgstr "" 149 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "buddy-deploy", 3 | "description": "", 4 | "license": "GPL-2.0-or-later", 5 | "main": "build/index.js", 6 | "scripts": { 7 | "build": "wp-scripts build", 8 | "format": "wp-scripts format", 9 | "lint:css": "wp-scripts lint-style", 10 | "lint:js": "wp-scripts lint-js", 11 | "start": "wp-scripts start", 12 | "packages-update": "wp-scripts packages-update" 13 | }, 14 | "dependencies": { 15 | "@wordpress/block-editor": "7.0.1", 16 | "@wordpress/blocks": "11.0.1", 17 | "@wordpress/i18n": "4.2.1", 18 | "react-tabs": "^3.2.2" 19 | }, 20 | "devDependencies": { 21 | "@wordpress/scripts": "18.0.0" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | # Deploy Buddy 2 | 3 | Stable tag: 1.3.2 4 | Requires at least: 5.0 5 | Tested up to: 5.8 6 | Requires PHP: 7.2 7 | License: GPL v2 or later 8 | Tags: ci/cd, deployments, static, developer 9 | Contributors: palmiak 10 | 11 |  12 | 13 | Seamlessly trigger [Buddy CI/CD](https://buddy.works/) deploys from WordPress. 14 | 15 | ## Description 16 | 17 | ### Plugin Installation 18 | 19 | 1. Download the latest [release](https://github.com/palmiak/buddy_deploy/releases/). 20 | 2. Upload the plugin in WordPress admin panel. 21 | 22 | ### Updates 23 | 24 | To keep this plugin up-to-date, install and configure the [Git Updater](https://github.com/afragen/git-updater). 25 | 26 | ### Get your webhook url 27 | 28 | 1. Sign in to your [Buddy](http://buddy.works) account. 29 | 2. Go to your project and select the pipeline you want to execute using the plugin. 30 | 3. Click **Webhook URL** in the right sidebar and copy the URL. 31 | 32 | ### Configuration 33 | 34 | You can configure the plugin using the UI or by using constants in the `wp-config.php` file. 35 | 36 | ### Available constants 37 | 38 | - `buddy_webhook` - default: `false` - bool - adds the webhook url 39 | - `buddy_manual_deploy` - default: `true` - bool - enables automatic deployments 40 | - `buddy_topbar` - default: `true` - bool - adds the deploy button to the admin bar 41 | - `buddy_manual_deploy_capabilities` - default: `manage_options` - string - capability required to see the deploy button 42 | - `buddy_capabilities_options` - default: `manage_options` - string - capability required to view options panel 43 | - `buddy_automatic_deploy` - default: `false` - bool - enables automatic deployments 44 | - `buddy_automatic_deploy_post_types` - default: `['post', 'page']` - array - post types which trigger automatic deployments 45 | - `buddy_automatic_deploy_capabilities` - default: `manage_options` - string - capability required to trigger automatic deployments 46 | 47 | ## Changelog 48 | 49 | ### 1.3.3 50 | 51 | - Changed the default value of `automatic deployments`. 52 | 53 | ### 1.3.2 54 | 55 | - More small fixes. 56 | 57 | ### 1.3.1 58 | 59 | - Removed development leftovers. 60 | 61 | ### 1.3.0 62 | 63 | - Settings screen rewrote to use Gutenberg. 64 | 65 | ### 1.2.4 66 | 67 | - Added some missing constatns in readme and in context help. 68 | 69 | ### 1.2.3 70 | 71 | - Lots of typos and descriptions fixed - all thanks to @tomekpapiernik. 72 | 73 | ### 1.2.2 74 | 75 | - Fixed the problem with Automatic Deployments running twice. 76 | 77 | ### 1.2.1 78 | 79 | - Minor coding fix. 80 | 81 | ### 1.2.0 82 | 83 | - Added **Gutenberg** Support - you can trigger the deployment even in Full Screen Mode in Gutenberg. 84 | - Fixed some typos. 85 | 86 | ### 1.1.1 87 | 88 | - Small fix with adding menu button. 89 | 90 | ### 1.1.0 91 | 92 | - Moved inline documentation into context help tab. 93 | - Fixed checkboxes not fully working in some cases. 94 | - Some other minor fixes. 95 | 96 | ### 1.0.0 97 | 98 | - Added a **configuration** tab. Since now using constants is not required. 99 | 100 | ### 0.2.1 101 | 102 | - Fixed a minor bug and a typo in readme. 103 | 104 | ### 0.2.0 105 | 106 | - Added automatic deployments. 107 | 108 | ### 0.1.5 109 | 110 | - Minor fix for empty webhook. 111 | 112 | ### 0.1.4 113 | 114 | - You can install and mange the plugin with composer. Just run `composer require buddy/deploy-buddy`. 115 | 116 | ### 0.1.3 117 | 118 | - Updates are made with [Git Updater](https://github.com/afragen/git-updater) 119 | 120 | ### 0.1.2 121 | 122 | - Made the admin panel a lot nicer 123 | - Fixed some minor bugs. 124 | 125 | ### 0.1.1 126 | 127 | - Fixed some minor bugs. 128 | - Plugin is fully translatable 129 | 130 | ### 0.1.0 131 | 132 | - Initial release 133 | -------------------------------------------------------------------------------- /readme.txt: -------------------------------------------------------------------------------- 1 | === Deploy Buddy === 2 | 3 | Stable tag: 1.2.2 4 | Requires at least: 5.0 5 | Tested up to: 5.8 6 | Requires PHP: 7.2 7 | License: GPL v2 or later 8 | Tags: ci/cd, deployments, static, developer 9 | Contributors: palmiak 10 | 11 |  12 | 13 | Seamlessly trigger Buddy.works deploys from WordPress. 14 | == Description == 15 | 16 | = Plugin Installation = 17 | 18 | 1. Download the latest zip from [releases](https://github.com/palmiak/buddy_deploy/releases/) 19 | 2. Upload the plugin in WordPress admin panel 20 | 21 | = Updates = 22 | 23 | If you want to keep this plugin up-to-date install and configurebuddy_webhook
- default: \'\'
- adds the webhook urlbuddy_manual_deploy
- default: true
- enables or disables manual deploymentsbuddy_topbar
- default: true
- adds the deploy button to the admin barbuddy_manual_deploy_capabilities
- default: manage_options
- capability required to see the deploy buttonbuddy_capabilities_options
- default: manage_options
- capability required to view options panelbuddy_automatic_deploy
- default: false
- enables or disables automatic deploymentsbuddy_automatic_deploy_post_types
- default: [\'post\', \'page\']
- post types which trigger automatic deploymentsbuddy_automatic_deploy_capabilities
- default: manage_options
- capability required to trigger automatic deploymentsWebhook is already defined in wp-config.php
file.
%1$s %3$s %4$s
', 41 | esc_html__( 'Webhook not set! Please set it in', Config::get( 'language_slug' ) ), 42 | esc_url( 'tools.php?page=deploy-buddy&tab=settings' ), 43 | esc_html__( 'the Settings Tab', Config::get( 'language_slug' ) ), 44 | esc_html__( '.', Config::get( 'language_slug' ) ) 45 | ); 46 | } 47 | 48 | /** 49 | * Start! 50 | * 51 | * @return void 52 | */ 53 | function boot() { 54 | new BuddyIntegration(); 55 | } 56 | 57 | function requirements_met() { 58 | return ( options_helper( 'buddy_webhook', false ) !== false ) ? true : false; 59 | } 60 | 61 | function capabilities_helper( $type ) { 62 | if ( function_exists( 'BuddyIntegration\\' . $type ) ) { 63 | return call_user_func( 'BuddyIntegration\\' . $type ); 64 | } 65 | 66 | return false; 67 | } 68 | 69 | function top_bar() { 70 | return is_admin_bar_showing() && ! empty( Config::get( 'webhook' ) ) && Config::get( 'manual_deploy' ) && Config::get( 'add_to_topbar' ) && current_user_can( Config::get( 'manual_deploy_capabilities' ) ); 71 | } 72 | 73 | function manual_deploy() { 74 | return ! empty( Config::get( 'webhook' ) ) && Config::get( 'manual_deploy' ) && current_user_can( Config::get( 'manual_deploy_capabilities' ) ); 75 | } 76 | 77 | function automatic_deploy() { 78 | return ! empty( Config::get( 'webhook' ) ) && Config::get( 'automatic_deploy' ) && ! empty( Config::get( 'automatic_deploy_post_types' ) ) && current_user_can( Config::get( 'automatic_deploy_capabilities' ) ); 79 | } 80 | 81 | function edit_options() { 82 | return current_user_can( Config::get( 'capabilities_options' ) ); 83 | } 84 | 85 | function options_helper( $key_name, $default ) { 86 | if ( defined( $key_name ) ) { 87 | return constant( $key_name ); 88 | } else { 89 | return get_option( $key_name, $default ); 90 | } 91 | } 92 | function update_settings() { 93 | $option_keys = array( 94 | 'buddy_webhook', 95 | 'buddy_topbar', 96 | 'buddy_manual_deploy_capabilities', 97 | 'buddy_manual_deploy', 98 | 'buddy_automatic_deploy', 99 | 'buddy_automatic_deploy_post_types', 100 | 'buddy_automatic_deploy_capabilities', 101 | 'buddy_capabilities_options', 102 | ); 103 | 104 | $old_options = get_option( 'options-page' ); 105 | 106 | if ( $old_options && count( $old_options ) > 0 ) { 107 | foreach( $option_keys as $option ) { 108 | if ( isset( $old_options[ $option ] ) ) { 109 | // CMB had this weird thing about storing false, so they were store as on or off. 110 | if ( in_array( $option, array( 'buddy_manual_deploy', 'buddy_topbar', 'buddy_automatic_deploy' ) ) ) { 111 | $value = $old_options[ $option ] === 'on' ? true : false; 112 | update_option( $option, $value ); 113 | } else { 114 | update_option( $option, $old_options[ $option ] ); 115 | } 116 | } 117 | } 118 | } 119 | 120 | update_option( 'buddy_options_version', 2 ); 121 | } 122 | -------------------------------------------------------------------------------- /src/index.js: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /templates/automatic_deploy.php: -------------------------------------------------------------------------------- 1 | - ' . $value . ''; 7 | }, 8 | Config::get( 'automatic_deploy_post_types' ) 9 | ); 10 | ?> 11 | 12 |buddy_automatic_deploy_capabilities
constant to wp-config.php file.', Config::get( 'language_slug' ) ); ?>
19 |
20 | To change the post types, go to the plugin\'s settings tab or add buddy_automatic_deploy_post_types
constant to wp-config.php file.', Config::get( 'language_slug' ) ); ?>
21 |
22 | Automatic deployments are disabled.', Config::get( 'language_slug' ) ); ?>
23 |
24 | If options are missing from the Settings tab, it means they are declared in the wp-config.php
. Remove the declarations from the wp-config.php
file to adjust the corresponding options here.
wp-config.php
file.',
26 | Config::get( 'language_slug' )
27 | );
28 | ?>
29 | buddy_webhook
- default: \'\' - sets the webhook
34 | buddy_topbar
- default: true - adds the deploy button to the admin bar
buddy_manual_deploy_capabilities
- default: manage_options - capability that is needed to see the deploy button
buddy_automatic_deploy
- default: false - turn on or off automatic deployments on post update.
buddy_automatic_deploy_post_types
- default: [\'post\', \'page\'] - sets on which post types does the update triggers the auto deploy.
buddy_automatic_deploy_capabilities
- default: manage_options - capability that is need to run the auto deploy.