Skip to content

Commit b6a8c0a

Browse files
committed
Update README / add some more inputs
1 parent e994c43 commit b6a8c0a

File tree

2 files changed

+69
-0
lines changed

2 files changed

+69
-0
lines changed
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# push-image-digests
2+
3+
This is a composite GitHub Action, used to push image digests to GitHub, so then they can be picked up by the `push-to-gar-docker-multiarch` action, to create a manifest and push the actual image to GAR.
4+
5+
This action can be used as a standalone one for fast testing, in case the developer wants to test things on their PR.
6+
7+
```yaml
8+
name: CI
9+
on:
10+
pull_request:
11+
12+
# These permissions are needed to assume roles from Github's OIDC.
13+
permissions:
14+
contents: read
15+
id-token: write
16+
17+
jobs:
18+
build-and-push:
19+
runs-on: ubuntu-latest
20+
21+
steps:
22+
- id: checkout
23+
uses: actions/checkout@v4
24+
25+
- id: push-to-gar
26+
uses: grafana/shared-workflows/actions/push-image-digests@main
27+
with:
28+
registry: "<YOUR-GAR>" # e.g. us-docker.pkg.dev, optional
29+
tags: |-
30+
"<IMAGE_TAG>"
31+
"latest"
32+
context: "<YOUR_CONTEXT>" # e.g. "." - where the Dockerfile is
33+
image_name: "backstage" # name of the image to be published, required
34+
environment: "dev" # can be either dev/prod
35+
```
36+
37+
## Inputs
38+
39+
| Name | Type | Description |
40+
| ---------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
41+
| `registry` | String | Google Artifact Registry to store docker images in. |
42+
| `tags` | List | Tags that should be used for the image (see the [metadata-action][mda] for details) |
43+
| `context` | List | Path to the Docker build context. |
44+
| `environment` | Bool | Environment for pushing artifacts (can be either dev or prod). |
45+
| `image_name` | String | Name of the image to be pushed to GAR. |
46+
| `build-args` | String | List of arguments necessary for the Docker image to be built. |
47+
| `push` | Boolean | Whether to push the image to the registry. |
48+
| `file` | String | Path and filename of the dockerfile to build from. (Default: `{context}/Dockerfile`) |
49+
| `platforms` | List | List of platforms the image should be built for (e.g. `linux/amd64,linux/arm64`) |
50+
| `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/)) |
51+
| `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/)) |
52+
| `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)) |
53+
| `build-contexts` | List | List of additional [build contexts](https://github.com/docker/build-push-action?tab=readme-ov-file#inputs) (e.g., `name=path`) |
54+
| `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 |
55+
56+
[mda]: https://github.com/docker/metadata-action?tab=readme-ov-file#tags-input

actions/push-image-digests/action.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,16 @@ inputs:
4747
ssh:
4848
description: |
4949
List of SSH agent socket or keys to expose to the build
50+
build-contexts:
51+
description: |
52+
List of additional build contexts (e.g., name=path)
53+
required: false
54+
docker-buildx-driver:
55+
description: |
56+
The driver to use for Docker Buildx
57+
required: false
58+
default: "docker-container"
59+
5060

5161
outputs:
5262
full_image_name:
@@ -107,6 +117,8 @@ runs:
107117
images: ${FULL_IMAGE_NAME}
108118
- name: Set up Docker Buildx
109119
uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3.0.0
120+
with:
121+
driver: ${{ inputs.docker-buildx-driver }}
110122
- name: Build the container
111123
uses: docker/build-push-action@4a13e500e55cf31b7a5d59a38ab2040ab0f42f56 # v5.1.0
112124
id: build
@@ -120,6 +132,7 @@ runs:
120132
file: ${{ inputs.file }}
121133
platforms: ${{ inputs.platform }}
122134
ssh: ${{ inputs.ssh }}
135+
build-contexts: ${{ inputs.build-contexts }}
123136
- name: Export digest
124137
shell: bash
125138
run: |

0 commit comments

Comments
 (0)