|
99 | 99 | "env": { |
100 | 100 | "NODE_ENV": "production" |
101 | 101 | }, |
102 | | - "ports": [8080], |
103 | | - "volumes": ["/tmp:/tmp"], |
104 | 102 | "options": "--cpus 2" |
105 | 103 | } |
106 | 104 | ``` |
107 | 105 |
|
108 | | - All properties from GitHub's container specification are supported except credentials (use secrets instead). |
| 106 | + Supported properties: image (required), env (object), options (string). |
| 107 | + Note: ports and volumes are not currently supported due to GitHub Actions limitations. |
| 108 | +
|
| 109 | + For container registry credentials (username/password), use the container-registry-username |
| 110 | + and container-registry-password secrets. |
| 111 | +
|
109 | 112 | See https://docs.github.com/en/actions/how-tos/write-workflows/choose-where-workflows-run/run-jobs-in-a-container |
110 | 113 |
|
111 | 114 | When specified, steps will execute inside this container instead of checking out code. |
|
123 | 126 | SECRET_EXAMPLE=$\{{ secrets.SECRET_EXAMPLE }} |
124 | 127 | ``` |
125 | 128 | required: false |
| 129 | + container-registry-username: |
| 130 | + description: | |
| 131 | + Username for authenticating to the container registry. |
| 132 | + Required when using private container images. |
| 133 | + required: false |
| 134 | + container-registry-password: |
| 135 | + description: | |
| 136 | + Password or token for authenticating to the container registry. |
| 137 | + Required when using private container images. |
| 138 | + required: false |
126 | 139 | outputs: |
127 | 140 | build-artifact-id: |
128 | 141 | description: "ID of the build artifact) uploaded during the build step." |
@@ -167,16 +180,6 @@ jobs: |
167 | 180 | config.env = container.env; |
168 | 181 | } |
169 | 182 | |
170 | | - // Add ports if provided |
171 | | - if (container.ports && container.ports.length > 0) { |
172 | | - config.ports = container.ports; |
173 | | - } |
174 | | - |
175 | | - // Add volumes if provided |
176 | | - if (container.volumes && container.volumes.length > 0) { |
177 | | - config.volumes = container.volumes; |
178 | | - } |
179 | | - |
180 | 183 | // Merge user options with default --user root:root |
181 | 184 | if (container.options) { |
182 | 185 | config.options = `${config.options} ${container.options}`; |
@@ -218,7 +221,13 @@ jobs: |
218 | 221 | setup: |
219 | 222 | name: ⚙️ Setup |
220 | 223 | runs-on: ${{ inputs.runs-on && fromJson(inputs.runs-on) || 'ubuntu-latest' }} |
221 | | - container: ${{ inputs.container != '' && fromJSON(needs.parse-container.outputs.config) || null }} |
| 224 | + container: |
| 225 | + image: ${{ inputs.container != '' && fromJSON(needs.parse-container.outputs.config).image || null }} |
| 226 | + env: ${{ inputs.container != '' && fromJSON(needs.parse-container.outputs.config).env || null }} |
| 227 | + options: ${{ inputs.container != '' && fromJSON(needs.parse-container.outputs.config).options || null }} |
| 228 | + credentials: |
| 229 | + username: ${{ secrets.container-registry-username }} |
| 230 | + password: ${{ secrets.container-registry-password }} |
222 | 231 | needs: parse-container |
223 | 232 | if: ${{ always() && !cancelled() && !failure() }} |
224 | 233 | permissions: |
@@ -336,7 +345,13 @@ jobs: |
336 | 345 | name: 👕 Lint |
337 | 346 | if: inputs.checks == true && inputs.lint && always() && !cancelled() && !failure() |
338 | 347 | runs-on: ${{ inputs.runs-on && fromJson(inputs.runs-on) || 'ubuntu-latest' }} |
339 | | - container: ${{ inputs.container != '' && fromJSON(needs.parse-container.outputs.config) || null }} |
| 348 | + container: |
| 349 | + image: ${{ inputs.container != '' && fromJSON(needs.parse-container.outputs.config).image || null }} |
| 350 | + env: ${{ inputs.container != '' && fromJSON(needs.parse-container.outputs.config).env || null }} |
| 351 | + options: ${{ inputs.container != '' && fromJSON(needs.parse-container.outputs.config).options || null }} |
| 352 | + credentials: |
| 353 | + username: ${{ secrets.container-registry-username }} |
| 354 | + password: ${{ secrets.container-registry-password }} |
340 | 355 | needs: |
341 | 356 | - parse-container |
342 | 357 | - setup |
@@ -392,7 +407,13 @@ jobs: |
392 | 407 | if: inputs.checks == true && always() && !cancelled() && !failure() |
393 | 408 | runs-on: ${{ inputs.runs-on && fromJson(inputs.runs-on) || 'ubuntu-latest' }} |
394 | 409 | # jscpd:ignore-start |
395 | | - container: ${{ inputs.container != '' && fromJSON(needs.parse-container.outputs.config) || null }} |
| 410 | + container: |
| 411 | + image: ${{ inputs.container != '' && fromJSON(needs.parse-container.outputs.config).image || null }} |
| 412 | + env: ${{ inputs.container != '' && fromJSON(needs.parse-container.outputs.config).env || null }} |
| 413 | + options: ${{ inputs.container != '' && fromJSON(needs.parse-container.outputs.config).options || null }} |
| 414 | + credentials: |
| 415 | + username: ${{ secrets.container-registry-username }} |
| 416 | + password: ${{ secrets.container-registry-password }} |
396 | 417 | needs: |
397 | 418 | - parse-container |
398 | 419 | - setup |
@@ -438,7 +459,13 @@ jobs: |
438 | 459 | name: 🧪 Test |
439 | 460 | if: inputs.checks == true && inputs.test && always() && !cancelled() && !failure() |
440 | 461 | runs-on: ${{ inputs.runs-on && fromJson(inputs.runs-on) || 'ubuntu-latest' }} |
441 | | - container: ${{ inputs.container != '' && fromJSON(needs.parse-container.outputs.config) || null }} |
| 462 | + container: |
| 463 | + image: ${{ inputs.container != '' && fromJSON(needs.parse-container.outputs.config).image || null }} |
| 464 | + env: ${{ inputs.container != '' && fromJSON(needs.parse-container.outputs.config).env || null }} |
| 465 | + options: ${{ inputs.container != '' && fromJSON(needs.parse-container.outputs.config).options || null }} |
| 466 | + credentials: |
| 467 | + username: ${{ secrets.container-registry-username }} |
| 468 | + password: ${{ secrets.container-registry-password }} |
442 | 469 | needs: |
443 | 470 | - parse-container |
444 | 471 | - setup |
|
0 commit comments