|
1 | 1 | # action-convox-multi-slim |
2 | | -Multiple convox actions in one slim docker image |
3 | 2 |
|
4 | | -## Instructions for creating a new version |
| 3 | +Multiple Convox CLI commands in one slim Docker-based GitHub Action. Instead of using separate actions for each Convox operation, this single action supports 16 commands through the `action` input, reducing workflow boilerplate. |
5 | 4 |
|
6 | | -Make changes as appropriate |
| 5 | +## Supported Actions |
7 | 6 |
|
8 | | -Ensure docker daemon is running and you're logged into docker hub. |
| 7 | +`login` · `login-user` · `build` · `build-migrate` · `deploy` · `create` · `destroy` · `promote` · `rollback` · `run` · `scale` · `get-scale` · `env-set` · `find-release` · `get-rack-param` · `rack-param` |
| 8 | + |
| 9 | +## Quick Start |
| 10 | + |
| 11 | +```yaml |
| 12 | +# Step 1: Login to Convox (required before any other action) |
| 13 | +- uses: beastawakens/action-convox-multi-slim@v1 |
| 14 | + with: |
| 15 | + action: login |
| 16 | + password: ${{ secrets.CONVOX_PASSWORD }} |
| 17 | + |
| 18 | +# Step 2: Build your app |
| 19 | +- uses: beastawakens/action-convox-multi-slim@v1 |
| 20 | + id: build |
| 21 | + with: |
| 22 | + action: build |
| 23 | + rack: my-rack |
| 24 | + app: my-app |
| 25 | + description: "Build ${{ github.sha }}" |
| 26 | + |
| 27 | +# Step 3: Promote the release |
| 28 | +- uses: beastawakens/action-convox-multi-slim@v1 |
| 29 | + with: |
| 30 | + action: promote |
| 31 | + rack: my-rack |
| 32 | + app: my-app |
| 33 | + release: ${{ steps.build.outputs.RELEASE }} |
| 34 | +``` |
| 35 | +
|
| 36 | +## Inputs |
| 37 | +
|
| 38 | +| Input | Description | Required | Default | |
| 39 | +|-------|-------------|----------|---------| |
| 40 | +| `action` | Convox command to run (see supported actions above) | Yes | — | |
| 41 | +| `password` | Convox deploy key | For `login` | — | |
| 42 | +| `host` | Convox Console host address | No | `console.convox.com` | |
| 43 | +| `token` | Convox Console token | For `login-user` | — | |
| 44 | +| `rack` | Convox Rack name | For most actions | — | |
| 45 | +| `app` | Convox app name | For most actions | — | |
| 46 | +| `destinationApp` | Destination app name | For `build-migrate` | — | |
| 47 | +| `destinationRack` | Destination rack name | For `build-migrate` | — | |
| 48 | +| `description` | Build description | No | — | |
| 49 | +| `cached` | Use Docker cache during build | No | `true` | |
| 50 | +| `manifest` | Custom path for convox.yml | No | — | |
| 51 | +| `paramName` | Rack parameter name | For `get-rack-param`, `rack-param` | — | |
| 52 | +| `paramValue` | Rack parameter value | For `rack-param` | — | |
| 53 | +| `release` | Release ID (auto-detected from prior build step if omitted) | For `promote`, `rollback` | — | |
| 54 | +| `service` | Service name | For `run`, `scale`, `get-scale` | — | |
| 55 | +| `command` | Command to run | For `run` | — | |
| 56 | +| `count` | Instance count to scale to | For `scale` | — | |
| 57 | +| `env` | Env vars as `key1=value1 key2=value2` | For `env-set` | — | |
| 58 | + |
| 59 | +## Outputs |
| 60 | + |
| 61 | +| Output | Description | Set by | |
| 62 | +|--------|-------------|--------| |
| 63 | +| `RELEASE` | Release ID of the created build | `build`, `build-migrate`, `find-release` | |
| 64 | +| `DESIRED` | Count of desired instances | `get-scale` | |
| 65 | +| `RUNNING` | Count of running instances | `get-scale` | |
| 66 | +| `CPU` | CPU scale value | `get-scale` | |
| 67 | +| `MEMORY` | Memory scale value | `get-scale` | |
| 68 | +| `SCALING_EVENT` | `true` if desired ≠ running | `get-scale` | |
| 69 | +| `RUNNING_PROCESSES` | Count of running processes | `get-scale` | |
| 70 | +| `PENDING_PROCESSES` | Count of pending processes | `get-scale` | |
| 71 | +| `UNHEALTHY_PROCESSES` | Count of unhealthy processes | `get-scale` | |
| 72 | +| `PARAM_VALUE` | Rack parameter value | `get-rack-param` | |
| 73 | + |
| 74 | +## Action-by-Action Usage |
| 75 | + |
| 76 | +### login |
| 77 | + |
| 78 | +Stores Convox credentials for subsequent steps. Must be called before any other action. |
| 79 | + |
| 80 | +```yaml |
| 81 | +- uses: beastawakens/action-convox-multi-slim@v1 |
| 82 | + with: |
| 83 | + action: login |
| 84 | + password: ${{ secrets.CONVOX_PASSWORD }} |
| 85 | + host: console.convox.com # optional |
| 86 | +``` |
| 87 | + |
| 88 | +### login-user |
| 89 | + |
| 90 | +Authenticates an interactive user via token. |
| 91 | + |
| 92 | +```yaml |
| 93 | +- uses: beastawakens/action-convox-multi-slim@v1 |
| 94 | + with: |
| 95 | + action: login-user |
| 96 | + token: ${{ secrets.CONVOX_TOKEN }} |
| 97 | +``` |
| 98 | + |
| 99 | +### build |
| 100 | + |
| 101 | +Builds the app and returns the release ID. |
| 102 | + |
| 103 | +```yaml |
| 104 | +- uses: beastawakens/action-convox-multi-slim@v1 |
| 105 | + id: build |
| 106 | + with: |
| 107 | + action: build |
| 108 | + rack: my-rack |
| 109 | + app: my-app |
| 110 | + description: "Build ${{ github.sha }}" |
| 111 | + cached: true # optional, default true |
| 112 | + manifest: convox.yml # optional |
| 113 | +``` |
| 114 | + |
| 115 | +### deploy |
| 116 | + |
| 117 | +Builds and deploys in a single operation (waits for completion). |
| 118 | + |
| 119 | +```yaml |
| 120 | +- uses: beastawakens/action-convox-multi-slim@v1 |
| 121 | + with: |
| 122 | + action: deploy |
| 123 | + rack: my-rack |
| 124 | + app: my-app |
| 125 | + description: "Deploy ${{ github.sha }}" |
| 126 | +``` |
| 127 | + |
| 128 | +### build-migrate |
| 129 | + |
| 130 | +Exports a build from one app/rack and imports it to another. |
| 131 | + |
| 132 | +```yaml |
| 133 | +- uses: beastawakens/action-convox-multi-slim@v1 |
| 134 | + with: |
| 135 | + action: build-migrate |
| 136 | + rack: source-rack |
| 137 | + app: source-app |
| 138 | + destinationRack: dest-rack |
| 139 | + destinationApp: dest-app |
| 140 | +``` |
| 141 | + |
| 142 | +### create |
| 143 | + |
| 144 | +Creates a new Convox app. |
| 145 | + |
| 146 | +```yaml |
| 147 | +- uses: beastawakens/action-convox-multi-slim@v1 |
| 148 | + with: |
| 149 | + action: create |
| 150 | + rack: my-rack |
| 151 | + app: my-new-app |
| 152 | +``` |
| 153 | + |
| 154 | +### destroy |
| 155 | + |
| 156 | +Deletes a Convox app. |
| 157 | + |
| 158 | +```yaml |
| 159 | +- uses: beastawakens/action-convox-multi-slim@v1 |
| 160 | + with: |
| 161 | + action: destroy |
| 162 | + rack: my-rack |
| 163 | + app: my-app |
| 164 | +``` |
| 165 | + |
| 166 | +### promote |
| 167 | + |
| 168 | +Promotes a release to active. |
| 169 | + |
| 170 | +```yaml |
| 171 | +- uses: beastawakens/action-convox-multi-slim@v1 |
| 172 | + with: |
| 173 | + action: promote |
| 174 | + rack: my-rack |
| 175 | + app: my-app |
| 176 | + release: RABCDEF1234 # or auto-detected from prior build step |
| 177 | +``` |
| 178 | + |
| 179 | +### rollback |
| 180 | + |
| 181 | +Rolls back to a previous release. |
| 182 | + |
| 183 | +```yaml |
| 184 | +- uses: beastawakens/action-convox-multi-slim@v1 |
| 185 | + with: |
| 186 | + action: rollback |
| 187 | + rack: my-rack |
| 188 | + app: my-app |
| 189 | + release: RABCDEF1234 |
| 190 | +``` |
| 191 | + |
| 192 | +### run |
| 193 | + |
| 194 | +Runs a one-off command against a service. |
| 195 | + |
| 196 | +```yaml |
| 197 | +- uses: beastawakens/action-convox-multi-slim@v1 |
| 198 | + with: |
| 199 | + action: run |
| 200 | + rack: my-rack |
| 201 | + app: my-app |
| 202 | + service: web |
| 203 | + command: "rails db:migrate" |
| 204 | + release: RABCDEF1234 # optional |
| 205 | +``` |
| 206 | + |
| 207 | +### scale |
| 208 | + |
| 209 | +Scales a service to a specific instance count. |
| 210 | + |
| 211 | +```yaml |
| 212 | +- uses: beastawakens/action-convox-multi-slim@v1 |
| 213 | + with: |
| 214 | + action: scale |
| 215 | + rack: my-rack |
| 216 | + app: my-app |
| 217 | + service: web |
| 218 | + count: 3 |
| 219 | +``` |
| 220 | + |
| 221 | +### get-scale |
| 222 | + |
| 223 | +Retrieves current scale information and process status. |
| 224 | + |
| 225 | +```yaml |
| 226 | +- uses: beastawakens/action-convox-multi-slim@v1 |
| 227 | + id: scale-info |
| 228 | + with: |
| 229 | + action: get-scale |
| 230 | + rack: my-rack |
| 231 | + app: my-app |
| 232 | + service: web |
| 233 | +
|
| 234 | +- run: | |
| 235 | + echo "Desired: ${{ steps.scale-info.outputs.DESIRED }}" |
| 236 | + echo "Running: ${{ steps.scale-info.outputs.RUNNING }}" |
| 237 | + echo "Scaling: ${{ steps.scale-info.outputs.SCALING_EVENT }}" |
| 238 | +``` |
| 239 | + |
| 240 | +### env-set |
| 241 | + |
| 242 | +Sets environment variables on an app. |
| 243 | + |
| 244 | +```yaml |
| 245 | +- uses: beastawakens/action-convox-multi-slim@v1 |
| 246 | + with: |
| 247 | + action: env-set |
| 248 | + rack: my-rack |
| 249 | + app: my-app |
| 250 | + env: "KEY1=value1 KEY2=value2" |
| 251 | +``` |
| 252 | + |
| 253 | +### find-release |
| 254 | + |
| 255 | +Finds the first release matching a description. |
| 256 | + |
| 257 | +```yaml |
| 258 | +- uses: beastawakens/action-convox-multi-slim@v1 |
| 259 | + id: found |
| 260 | + with: |
| 261 | + action: find-release |
| 262 | + rack: my-rack |
| 263 | + app: my-app |
| 264 | + description: "target-description" |
| 265 | +``` |
| 266 | + |
| 267 | +### get-rack-param |
| 268 | + |
| 269 | +Retrieves a rack parameter value. |
| 270 | + |
| 271 | +```yaml |
| 272 | +- uses: beastawakens/action-convox-multi-slim@v1 |
| 273 | + id: param |
| 274 | + with: |
| 275 | + action: get-rack-param |
| 276 | + rack: my-rack |
| 277 | + paramName: my_param |
| 278 | +
|
| 279 | +- run: echo "Value: ${{ steps.param.outputs.PARAM_VALUE }}" |
| 280 | +``` |
| 281 | + |
| 282 | +### rack-param |
| 283 | + |
| 284 | +Sets a rack parameter value. |
| 285 | + |
| 286 | +```yaml |
| 287 | +- uses: beastawakens/action-convox-multi-slim@v1 |
| 288 | + with: |
| 289 | + action: rack-param |
| 290 | + rack: my-rack |
| 291 | + paramName: my_param |
| 292 | + paramValue: new_value |
| 293 | +``` |
| 294 | + |
| 295 | +## Prerequisites |
| 296 | + |
| 297 | +- A Convox account with a deployed rack |
| 298 | +- A Convox deploy key (`password`) or user token (`token`) |
| 299 | +- The `login` or `login-user` action must be called before any other action in your workflow |
| 300 | + |
| 301 | +## Releasing a New Version |
9 | 302 |
|
10 | 303 | ```sh |
11 | 304 | export VERSION=v1.x.x |
12 | 305 | make release |
13 | 306 | ``` |
14 | 307 |
|
| 308 | +See [CONTRIBUTING.md](CONTRIBUTING.md) for development details. |
| 309 | + |
| 310 | +## License |
| 311 | + |
| 312 | +[Mozilla Public License 2.0](LICENSE) |
| 313 | + |
0 commit comments