-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
13 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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: | ||
|
||
|
@@ -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 ./ | ||
``` | ||
|
||
|