Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
imjasonh authored Oct 28, 2021
1 parent 789c5ef commit d7278ff
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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]`.
See [documentation for `ko`](https://github.com/google/ko#configuration) to learn more about configuring `ko`.
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.

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.
See [documentation for `ko`](https://github.com/google/ko#configuration) to learn more about configuring `ko`.

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:

Expand All @@ -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/[email protected]
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 ./
```

Expand Down

0 comments on commit d7278ff

Please sign in to comment.