Skip to content

Commit

Permalink
add push input to push-to-gar-docker action (#139)
Browse files Browse the repository at this point in the history
  • Loading branch information
joeyorlando authored Jun 5, 2024
1 parent cda1a65 commit 7817819
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 16 deletions.
31 changes: 16 additions & 15 deletions actions/push-to-gar-docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,21 +34,22 @@ jobs:
## Inputs
| Name | Type | Description |
| ---------------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `registry` | String | Google Artifact Registry to store docker images in. |
| `tags` | List | Tags that should be used for the image (see the [metadata-action][mda] for details) |
| `context` | List | Path to the Docker build context. |
| `environment` | Bool | Environment for pushing artifacts (can be either dev or prod). |
| `image_name` | String | Name of the image to be pushed to GAR. |
| `build-args` | String | List of arguments necessary for the Docker image to be built. |
| `file` | String | Path and filename of the dockerfile to build from. (Default: `{context}/Dockerfile`) |
| `platforms` | List | List of platforms the image should be built for (e.g. `linux/amd64,linux/arm64`) |
| `cache-from` | String | Where cache should be fetched from ([more about GHA and container caching](https://www.kenmuse.com/blog/implementing-docker-layer-caching-in-github-actions/)) |
| `cache-to` | String | Where cache should be stored to ([more about GHA and container caching](https://www.kenmuse.com/blog/implementing-docker-layer-caching-in-github-actions/)) |
| `ssh` | List | List of SSH agent socket or keys to expose to the build ([more about ssh for docker/build-push-action](https://github.com/docker/build-push-action?tab=readme-ov-file#inputs)) |
| `build-contexts` | List | List of additional [build contexts](https://github.com/docker/build-push-action?tab=readme-ov-file#inputs) (e.g., `name=path`) |
| `docker-buildx-driver` | String | The [driver](https://github.com/docker/setup-buildx-action/tree/v3/?tab=readme-ov-file#customizing) to use for Docker Buildx |
| Name | Type | Description |
| ---------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `registry` | String | Google Artifact Registry to store docker images in. |
| `tags` | List | Tags that should be used for the image (see the [metadata-action][mda] for details) |
| `context` | List | Path to the Docker build context. |
| `environment` | Bool | Environment for pushing artifacts (can be either dev or prod). |
| `image_name` | String | Name of the image to be pushed to GAR. |
| `build-args` | String | List of arguments necessary for the Docker image to be built. |
| `push` | Boolean | Whether to push the image to the registry. |
| `file` | String | Path and filename of the dockerfile to build from. (Default: `{context}/Dockerfile`) |
| `platforms` | List | List of platforms the image should be built for (e.g. `linux/amd64,linux/arm64`) |
| `cache-from` | String | Where cache should be fetched from ([more about GHA and container caching](https://www.kenmuse.com/blog/implementing-docker-layer-caching-in-github-actions/)) |
| `cache-to` | String | Where cache should be stored to ([more about GHA and container caching](https://www.kenmuse.com/blog/implementing-docker-layer-caching-in-github-actions/)) |
| `ssh` | List | List of SSH agent socket or keys to expose to the build ([more about ssh for docker/build-push-action](https://github.com/docker/build-push-action?tab=readme-ov-file#inputs)) |
| `build-contexts` | List | List of additional [build contexts](https://github.com/docker/build-push-action?tab=readme-ov-file#inputs) (e.g., `name=path`) |
| `docker-buildx-driver` | String | The [driver](https://github.com/docker/setup-buildx-action/tree/v3/?tab=readme-ov-file#customizing) to use for Docker Buildx |

## Outputs

Expand Down
7 changes: 6 additions & 1 deletion actions/push-to-gar-docker/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ inputs:
description: |
List of arguments necessary for the Docker image to be built.
default: ""
push:
description: |
Whether to push the image to the registry.
required: false
default: ${{ github.event_name == 'push' }}
file:
description: |
The dockerfile to use.
Expand Down Expand Up @@ -134,7 +139,7 @@ runs:
with:
context: ${{ inputs.context }}
build-args: ${{ inputs.build-args }}
push: ${{ github.event_name == 'push' }}
push: ${{ inputs.push == 'true' }}
tags: ${{ steps.meta.outputs.tags }}
cache-from: ${{ inputs.cache-from }}
cache-to: ${{ inputs.cache-to }}
Expand Down

0 comments on commit 7817819

Please sign in to comment.