|
| 1 | +# Branch Deploy Usage Guide 📚 |
| 2 | + |
| 3 | +This document is a quick guide / cheatsheet for using the `branch-deploy` Action |
| 4 | + |
| 5 | +> This guide assumes default configuration options |
| 6 | +
|
| 7 | +## Deployment 🚀 |
| 8 | + |
| 9 | +Deployments respect your repository's branch protection settings. You can trigger either a regular or noop deployment: |
| 10 | + |
| 11 | +- `.deploy` - Triggers a regular deployment |
| 12 | +- `.deploy noop` - Triggers a noop deployment (think Terraform plan for example) |
| 13 | + |
| 14 | +## Deployment Locks 🔒 |
| 15 | + |
| 16 | +If you need to lock deployments so that only you can trigger them, you can use the following set of commands: |
| 17 | + |
| 18 | +- `.lock` - Locks deployments (sticky) so that only you can trigger them |
| 19 | +- `.unlock` - Removes the current deployment lock (if one exists) |
| 20 | +- `.lock --info` - Displays info about the current deployment lock if one exists |
| 21 | +- `.wcid` - An alias for `.lock --info`, it means "where can I deploy" |
| 22 | + |
| 23 | +## Deployment Permissions 🔑 |
| 24 | + |
| 25 | +In order to run any branch deployment commands, you need the following permissions: |
| 26 | + |
| 27 | +- `write` or `admin` permissions to the repository |
| 28 | +- You must either be the owner of the current deployment lock, or there must be no deployment lock |
| 29 | + |
| 30 | +## Example Workflow 📑 |
| 31 | + |
| 32 | +An example workflow for using this Action might look like this: |
| 33 | + |
| 34 | +1. A user creates an awesome new feature for their website |
| 35 | +2. The user creates a branch, commits their changes, and pushes the branch to GitHub |
| 36 | +3. The user opens a pull request to the `main` branch from their feature branch |
| 37 | +4. Once CI is passing and the user has the proper reviews on their pull request, they can continue |
| 38 | +5. The user grabs the deployment lock as they need an hour or two for validating their change -> `.lock` |
| 39 | +6. The lock is claimed and now only the user who claimed it can deploy |
| 40 | +7. The user runs `.deploy noop` to get a preview of their changes |
| 41 | +8. All looks good so the user runs `.deploy` and ships their code to production from their branch |
| 42 | +9. After an hour or so, all looks good so they merge their changes to the `main` branch |
| 43 | +10. Upon merging, they comment on their merged pull request `.unlock` to remove the lock |
| 44 | +11. Done! |
0 commit comments