Add GitHub Action to install and setup ko #347
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Example usage:
This workflow will install the latest released version of
ko
by default,ko login ghcr.io
using theGITHUB_TOKEN
secret, and setKO_DOCKER_REPO=ghcr.io/[owner]/[repo]
for future steps, so theko publish
step will publish toghcr.io/[owner]/[repo]/server-[md5]
.If a user wants to publish elsewhere, they can set
KO_DOCKER_REPO
themselves and provide credentials for that registry.The action takes an input to install a specific version of
ko
:Users can also specify
version: tip
to build and installko
from the tip of the main branch usinggo get
.A note on versioning
In general it's probably bad advice to recommend users reference the action from
@main
-- unintended breakages and possible vulnerabilities could ensue.When included in the google/ko repo and published to the GitHub Marketplace, the action definition will be released and versioned alongside existing
ko
binary releases. This means users will be able to specifyuses: google/ko@v1.2.3
to pick up v1.2.3 of the action definition, even though it would by default install the floating latest release ofko
.I don't have a good solution to this, maybe we could try to make
uses: google/ko@v1.2.3
also installv1.2.3
by default? Anyway I wanted to point it out as a possible cause of confusion.I've iterated on this in https://github.com/imjasonh/ghatest, where you can see an example workflow: https://github.com/imjasonh/ghatest/blob/main/.github/workflows/build.yaml
When this PR is merged, I'll delist https://github.com/marketplace/actions/setup-ko and publish google/ko's action to the GitHub Marketplace, where it will look mostly the same, with a better README.
cc @mattmoor who has some experience with GitHub Actions