From d7278ff6a3151c79deb16bc1c456c43bb9372a37 Mon Sep 17 00:00:00 2001 From: Jason Hall Date: Thu, 28 Oct 2021 11:14:58 -0400 Subject: [PATCH] Update README.md --- README.md | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 795a07e..2b4a675 100644 --- a/README.md +++ b/README.md @@ -27,17 +27,15 @@ jobs: _That's it!_ This workflow will build and publish your code to [GitHub Container Regsitry](https://ghcr.io). -By default, the action sets `KO_DOCKER_REPO=ghcr.io/[owner]/[repo]`. +By default, the action sets `KO_DOCKER_REPO=ghcr.io/[owner]/[repo]` for all subsequent steps, and uses the `${{ github.token }}` to authorize pushes to GHCR. + See [documentation for `ko`](https://github.com/google/ko#configuration) to learn more about configuring `ko`. -By default the action sets `KO_DOCKER_REPO` for all subsequent steps. -Instead, if the `env` is already set when the action runs, it will skip logging in to ghcr.io and propagate `KO_DOCKER_REPO` for subsequent steps. - -The action works on Linux and macOS [runners](https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners), and _should_ work for Windows runners when `ko` releases include Windows binaries (next `ko` release🤞! see [google/ko#339](https://github.com/google/ko/pull/339)) +The action works on Linux and macOS [runners](https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners). If you'd like support for Windows runners, [let me know](https://github.com/imjasonh/setup-ko/issues/new). ### Select `ko` version to install -By default, `imjasonh/setup-ko` installs the latest released version of `ko`. +By default, `imjasonh/setup-ko` installs the [latest released version of `ko`](https://github.com/google/ko/releases). You can select a version with the `version` parameter: @@ -51,18 +49,24 @@ To build and install `ko` from source using `go get`, specify `version: tip`. ### Pushing to other registries -By default, `imjasonh/setup-ko` configures `ko` to push images to [GitHub Container Registry](https://ghcr.io), but you can configure it to push to other registries. +By default, `imjasonh/setup-ko` configures `ko` to push images to [GitHub Container Registry](https://ghcr.io), but you can configure it to push to other registries as well. -To do this, you need to provide credentials to authorize the push. +If `KO_DOCKER_REPO` is already set when `setup-ko` runs, it will skip logging in to ghcr.io and will propagate `KO_DOCKER_REPO` for subsequent steps. + +To do this, you should provide credentials to authorize the push. You can use [encrypted secrets](https://docs.github.com/en/actions/reference/encrypted-secrets) to store the authorization token, and pass it to `ko login` before pushing: ``` + +steps: +... - uses: imjasonh/setup-ko@v0.4 + env: + KO_DOCKER_REPO: my.registry/my-repo - env: auth_token: ${{ secrets.auth_token }} run: | echo "${auth_token}" | ko login https://my.registry --username my-username --password-stdin - export KO_DOCKER_REPO=my.registry/my-repo ko publish ./ ```