{"id":22665163,"url":"https://github.com/br0ken-/platformsh-deploy","last_synced_at":"2025-03-29T09:28:49.251Z","repository":{"id":139226345,"uuid":"158119190","full_name":"BR0kEN-/platformsh-deploy","owner":"BR0kEN-","description":null,"archived":false,"fork":false,"pushed_at":"2018-11-21T10:33:12.000Z","size":10,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-02-04T00:34:02.358Z","etag":null,"topics":["automation","deploy","platformsh"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/BR0kEN-.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-11-18T19:29:06.000Z","updated_at":"2019-01-22T09:02:40.000Z","dependencies_parsed_at":null,"dependency_job_id":"2d86c0f7-b3ea-4487-a2a7-39cb5b1a6dd1","html_url":"https://github.com/BR0kEN-/platformsh-deploy","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BR0kEN-%2Fplatformsh-deploy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BR0kEN-%2Fplatformsh-deploy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BR0kEN-%2Fplatformsh-deploy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BR0kEN-%2Fplatformsh-deploy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BR0kEN-","download_url":"https://codeload.github.com/BR0kEN-/platformsh-deploy/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246165492,"owners_count":20734041,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["automation","deploy","platformsh"],"created_at":"2024-12-09T13:19:53.081Z","updated_at":"2025-03-29T09:28:49.246Z","avatar_url":"https://github.com/BR0kEN-.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Platform.sh\n\nThe deploy/build scripts for Platform.sh that needs to lay near `.platform.app.yaml`.\n\n## Hooks runner\n\nThe [hooks/hook.sh](hook.sh) is a Bash script that is capable to run `deploy` or `build` hook.\n\nExample of usage in `.platform.app.yaml`.\n\n```yaml\nhooks:\n  build: 'bash pfqaplatform_deploy/hook.sh build'\n  # Send a notification via Slack after the deploy.\n  deploy: 'bash pfqaplatform_deploy/hook.sh deploy slack'\n```\n\n### Configuration\n\nTo setup the runner properly you may need to edit available variables at the top of the file.\n\n- `ACTION` - the action to perform, defaults to `$1`.\n- `NOTIFIER` - one of the available notification clients (the name of a `*.php` script in the `.deploy/notification` subdirectory) , defaults to `$2`.\n\n## Process\n\nWithin the `.deploy/$ACTION/` you may consider creating two handlers:\n\n  - `_succeeded.sh` - the file that will be included to a runtime once all commands in a process will successfully end.\n  - `_failed.sh` - the same as above, but only after the first non-zero return code (a process will be terminated).\n\nAvailable environment variables:\n\n- `PLATFORM_BRANCH` - the name of a Git branch an environment exists for (the `unknown-at-build-stage` if the action is `build`).\n\n*This script can be run locally if it doesn't rely on Platform.sh environment.*\n\n### Specific environment handlers\n\nThe `build` hook executes in an isolation, therefore, an environment cannot be determined. The opposite situation for `deploy` and this gives a possibility to perform environment-specific actions. The following Bash scripts may be included (after non-specific) to a runtime context if exist:\n\n- `.deploy/$ACTION/$PLATFORM_BRANCH/$ACTION.sh`\n- `.deploy/$ACTION/$PLATFORM_BRANCH/_succeeded.sh`\n- `.deploy/$ACTION/$PLATFORM_BRANCH/_failed.sh`\n\n### Notifications\n\nIndependently on a status of one of the hooks, you might consider sending the notification.\n\n#### Slack\n\nMake sure your `.platform.app.yaml` has the following contents:\n\n```yaml\nvariables:\n  env:\n    SLACK_WEBHOOK_URI: 'https://hooks.slack.com/services/ID1/ID2/ID3'\n    SLACK_CHANNEL: '#my-slack-channel'\n    SLACK_SENDER: 'My Slack channel'\n```\n\n#### Custom\n\n- Create the `NAME.php` inside the `.deploy/notification`.\n- Pass the `NAME` as a second argument to the `hook.sh`.\n- The `NAME.php` will receive two arguments: `EXIT_CODE` and `ACTION`.\n\nExample:\n\n```yaml\nhooks:\n  # Notify with \".deploy/notification/NAME.php\" about the \"build\".\n  build: 'bash pfqaplatform_deploy/hook.sh build NAME'\n  # Notify with \".deploy/notification/telegram.php\" about the \"deploy\".\n  deploy: 'bash pfqaplatform_deploy/hook.sh deploy telegram'\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbr0ken-%2Fplatformsh-deploy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbr0ken-%2Fplatformsh-deploy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbr0ken-%2Fplatformsh-deploy/lists"}