|
| 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 |
0 commit comments