Compare commits

..

38 Commits
fix-mv ... main

Author SHA1 Message Date
Carlos Tadeu Panato Junior
6c66175e66
Merge pull request #27 from ko-build/dependabot/github_actions/all-edf2abb101 2024-05-17 18:25:46 +02:00
dependabot[bot]
050a3ed674
Bump actions/checkout from 4.1.5 to 4.1.6 in the all group
Bumps the all group with 1 update: [actions/checkout](https://github.com/actions/checkout).


Updates `actions/checkout` from 4.1.5 to 4.1.6
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](44c2b7a8a4...a5ac7e51b4)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: all
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-05-17 16:24:06 +00:00
Carlos Tadeu Panato Junior
46e1a56aab
Merge pull request #26 from ko-build/dependabot/github_actions/all-e8df6e148d
Bump actions/checkout from 4.1.4 to 4.1.5 in the all group
2024-05-07 18:56:33 +02:00
dependabot[bot]
e08c44a432
Bump actions/checkout from 4.1.4 to 4.1.5 in the all group
Bumps the all group with 1 update: [actions/checkout](https://github.com/actions/checkout).


Updates `actions/checkout` from 4.1.4 to 4.1.5
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](0ad4b8fada...44c2b7a8a4)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: all
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-05-07 16:55:01 +00:00
Carlos Tadeu Panato Junior
5220d8c625
Merge pull request #25 from ko-build/dependabot/github_actions/all-b23e0286c6 2024-05-02 20:51:28 +02:00
dependabot[bot]
802088666f
Bump actions/setup-go from 5.0.0 to 5.0.1 in the all group
Bumps the all group with 1 update: [actions/setup-go](https://github.com/actions/setup-go).


Updates `actions/setup-go` from 5.0.0 to 5.0.1
- [Release notes](https://github.com/actions/setup-go/releases)
- [Commits](0c52d547c9...cdcb360436)

---
updated-dependencies:
- dependency-name: actions/setup-go
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: all
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-05-02 16:50:08 +00:00
Carlos Tadeu Panato Junior
d847f8f736
Merge pull request #24 from ko-build/dependabot/github_actions/all-b93eff89fb
Bump actions/checkout from 4.1.3 to 4.1.4 in the all group
2024-04-24 19:46:56 +02:00
dependabot[bot]
90bb33d882
Bump actions/checkout from 4.1.3 to 4.1.4 in the all group
Bumps the all group with 1 update: [actions/checkout](https://github.com/actions/checkout).


Updates `actions/checkout` from 4.1.3 to 4.1.4
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](1d96c772d1...0ad4b8fada)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: all
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-04-24 16:14:48 +00:00
Carlos Tadeu Panato Junior
9f49416da5
Merge pull request #22 from ko-build/dependabot/github_actions/all-32b83e8393 2024-04-20 09:07:28 +02:00
dependabot[bot]
df93bbee53
Bump actions/checkout from 4.1.2 to 4.1.3 in the all group
Bumps the all group with 1 update: [actions/checkout](https://github.com/actions/checkout).


Updates `actions/checkout` from 4.1.2 to 4.1.3
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](9bb56186c3...1d96c772d1)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: all
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-04-19 16:50:57 +00:00
Carlos Tadeu Panato Junior
f6bcbe6bd4
Merge pull request #21 from ko-build/dependabot/github_actions/all-2d71499196
Bump the all group with 1 update
2024-03-27 17:56:50 +01:00
dependabot[bot]
3a11ab50c5
Bump the all group with 1 update
Bumps the all group with 1 update: [actions/checkout](https://github.com/actions/checkout).


Updates `actions/checkout` from 4.1.1 to 4.1.2
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](b4ffde65f4...9bb56186c3)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: all
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-03-27 16:54:44 +00:00
Jason Hall
8c81b32820
Merge pull request #20 from cpanato/updates
group dependabot updates / upgrade to go1.22
2024-03-27 12:54:15 -04:00
cpanato
e2840e5a3e
upgrade to go1.22
Signed-off-by: cpanato <ctadeu@gmail.com>
2024-03-27 17:50:09 +01:00
cpanato
b4d3808a8b
group dependabot updates
Signed-off-by: cpanato <ctadeu@gmail.com>
2024-03-27 17:49:53 +01:00
Carlos Tadeu Panato Junior
a5165775f4
Merge pull request #19 from ko-build/dependabot/github_actions/actions/setup-go-5.0.0
Bump actions/setup-go from 4.0.1 to 5.0.0
2024-03-27 17:35:45 +01:00
dependabot[bot]
416bd13f30
Bump actions/setup-go from 4.0.1 to 5.0.0
Bumps [actions/setup-go](https://github.com/actions/setup-go) from 4.0.1 to 5.0.0.
- [Release notes](https://github.com/actions/setup-go/releases)
- [Commits](fac708d667...0c52d547c9)

---
updated-dependencies:
- dependency-name: actions/setup-go
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-03-27 16:22:33 +00:00
Carlos Tadeu Panato Junior
825a143e5b
Merge pull request #17 from ko-build/dependabot/github_actions/actions/checkout-4.1.1
Bump actions/checkout from 3.5.3 to 4.1.1
2024-03-27 17:21:35 +01:00
dependabot[bot]
d43a690c6e
Bump actions/checkout from 3.5.3 to 4.1.1
Bumps [actions/checkout](https://github.com/actions/checkout) from 3.5.3 to 4.1.1.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](c85c95e3d7...b4ffde65f4)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-10-17 17:10:11 +00:00
Jason Hall
2788447382
Merge pull request #12 from cpanato/updates
add dependabot config, ci job and general cleanup
2023-07-11 06:58:10 -04:00
cpanato
87e1ecde96
add dependabot config, ci job and general cleanup
Signed-off-by: cpanato <ctadeu@gmail.com>
2023-07-11 11:41:31 +02:00
Jason Hall
c03345ca95
Merge pull request #11 from ko-build/imjasonh-patch-1
Update README.md
2023-05-16 13:45:54 -04:00
Jason Hall
190bf66f15
Update README.md 2023-05-16 13:44:36 -04:00
Jason Hall
62953cd0e5
Update README.md (#10)
Use latest go release in example
2023-05-16 10:03:33 -07:00
Jason Hall
5565f737f4
Merge pull request #9 from ChaosInTheCRD/main
Make repository name lowercase to prevent issues with capitals
2023-04-26 14:07:24 -04:00
chaosinthecrd
c1f0b2fa3c
missed dollar 2023-04-26 17:50:04 +01:00
chaosinthecrd
e97ea1677f
set github repository string as lowercase 2023-04-26 17:42:12 +01:00
Jason Hall
f3c6980bb2
Merge pull request #7 from karthikraobr/fix-links
Fix links
2023-02-15 15:03:12 -05:00
Jason Hall
025ffaabff
Update action.yml 2023-02-15 15:02:20 -05:00
Kaarthik
f988078972 fix links 2023-02-15 15:43:34 +01:00
Jason Hall
1aeea0844e
Merge pull request #6 from imjasonh/rename
update references to imjasonh/setup-ko
2023-01-27 23:22:15 -05:00
Jason Hall
639397b858
update references to imjasonh/setup-ko 2023-01-12 16:43:19 -05:00
Jason Hall
6864af49ad
Merge pull request #5 from leongross/fix/highlighting 2022-11-24 16:40:06 -05:00
leongross
519c7c6b70
fix yaml highlighting 2022-11-24 15:32:14 +01:00
Jason Hall
c682db2712
update examples to latest versions 2022-09-06 14:20:30 -04:00
Jason Hall
6f13ec1511
note the breakage in the README 2022-09-06 14:01:41 -04:00
Jason Hall
c0b74d876a
use go 1.18 in GHA test, ko@tip requires 1.18 2022-09-06 13:55:51 -04:00
Jason Hall
ace48d7935
Merge pull request #4 from imjasonh/fix-mv
fix curl modes to point to new repo
2022-09-06 13:29:05 -04:00
6 changed files with 135 additions and 39 deletions

23
.github/dependabot.yml vendored Normal file
View File

@ -0,0 +1,23 @@
---
version: 2
updates:
- package-ecosystem: gomod
directory: "/"
schedule:
interval: "daily"
open-pull-requests-limit: 10
groups:
all:
update-types:
- "patch"
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
open-pull-requests-limit: 10
groups:
all:
update-types:
- "minor"
- "patch"

55
.github/workflows/ci.yaml vendored Normal file
View File

@ -0,0 +1,55 @@
name: ci
on:
pull_request:
jobs:
test-ko-action:
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1
with:
go-version: '1.22'
check-latest: 'true'
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
# Minimal publish
- uses: ./
- run: ko publish --bare ./
if: ${{ github.event_name == 'pull_request' }}
env:
KO_DOCKER_REPO: ko.local
- name: Install old release
uses: ./
with:
version: v0.8.0
- name: Check installed version
run: ko version | grep 0.8.0
- name: Install from tip
uses: ./
with:
version: tip
- name: Check installed version (tip)
run: |
sudo rm /usr/local/bin/ko # Uninstall previous versions.
ko version
# If KO_DOCKER_REPO is set during setup, it's set for future steps.
- name: Pre-set KO_DOCKER_REPO
uses: ./
env:
KO_DOCKER_REPO: already-set
- name: Check pre-set KO_DOCKER_REPO
run: |
if [[ "${KO_DOCKER_REPO}" != "already-set" ]]; then
echo "${KO_DOCKER_REPO} != already-set"
exit 1
fi

View File

@ -2,37 +2,47 @@ name: Use Action
on: on:
push: push:
branches: ['main'] branches:
- 'main'
jobs: jobs:
use-action: use-action:
name: Use Action name: Use Action
strategy: strategy:
matrix: matrix:
platform: [ubuntu-latest, macos-latest] platform:
- ubuntu-latest
- macos-latest
runs-on: ${{ matrix.platform }} runs-on: ${{ matrix.platform }}
steps: steps:
- uses: actions/setup-go@v2 - uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1
with: with:
go-version: 1.16 go-version: '1.22'
- uses: actions/checkout@v2 check-latest: 'true'
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
# Minimal publish # Minimal publish
- uses: imjasonh/setup-ko@main - uses: ko-build/setup-ko@main
- run: ko publish --bare ./ - run: ko publish --bare ./
- name: Install old release - name: Install old release
uses: imjasonh/setup-ko@main uses: ko-build/setup-ko@main
with: with:
version: v0.8.0 version: v0.8.0
- name: Check installed version - name: Check installed version
run: ko version | grep 0.8.0 run: ko version | grep 0.8.0
- name: Install from tip - name: Install from tip
uses: imjasonh/setup-ko@main uses: ko-build/setup-ko@main
with: with:
version: tip version: tip
- name: Check installed version (tip) - name: Check installed version (tip)
run: | run: |
sudo rm /usr/local/bin/ko # Uninstall previous versions. sudo rm /usr/local/bin/ko # Uninstall previous versions.
@ -40,9 +50,10 @@ jobs:
# If KO_DOCKER_REPO is set during setup, it's set for future steps. # If KO_DOCKER_REPO is set during setup, it's set for future steps.
- name: Pre-set KO_DOCKER_REPO - name: Pre-set KO_DOCKER_REPO
uses: imjasonh/setup-ko@main uses: ko-build/setup-ko@main
env: env:
KO_DOCKER_REPO: already-set KO_DOCKER_REPO: already-set
- name: Check pre-set KO_DOCKER_REPO - name: Check pre-set KO_DOCKER_REPO
run: | run: |
if [[ "${KO_DOCKER_REPO}" != "already-set" ]]; then if [[ "${KO_DOCKER_REPO}" != "already-set" ]]; then

View File

@ -1,6 +1,10 @@
# GitHub Action to install and setup [`ko`](https://github.com/google/ko) # GitHub Action to install and setup [`ko`](https://github.com/ko-build/ko)
[![Build](https://github.com/imjasonh/setup-ko/actions/workflows/use-action.yaml/badge.svg)](https://github.com/imjasonh/setup-ko/actions/workflows/use-action.yaml) [![Build](https://github.com/ko-build/setup-ko/actions/workflows/use-action.yaml/badge.svg)](https://github.com/ko-build/setup-ko/actions/workflows/use-action.yaml)
> :warning: Note: `ko` recently [moved to its own GitHub org](https://github.com/ko-build/ko/issues/791), which broke `setup-ko@v0.5` if the `ko` version wasn't specified.
>
> To fix this, either upgrade to [`setup-ko@v0.6`](https://github.com/ko-build/setup-ko/releases/tag/v0.6) or specify `version`
## Example usage ## Example usage
@ -16,63 +20,63 @@ jobs:
name: Publish name: Publish
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/setup-go@v2 - uses: actions/setup-go@v4
with: with:
go-version: 1.15 go-version: '1.20.x'
- uses: actions/checkout@v2 - uses: actions/checkout@v3
- uses: imjasonh/setup-ko@v0.4 - uses: ko-build/setup-ko@v0.6
- run: ko publish ./ - run: ko build
``` ```
_That's it!_ This workflow will build and publish your code to [GitHub Container Regsitry](https://ghcr.io). _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]` for all subsequent steps, and uses the `${{ github.token }}` to authorize pushes to GHCR. 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`. See [documentation for `ko`](https://ko.build/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). If you'd like support for Windows runners, [let me know](https://github.com/imjasonh/setup-ko/issues/new). 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 us know](https://github.com/ko-build/setup-ko/issues/new)!
### Select `ko` version to install ### Select `ko` version to install
By default, `imjasonh/setup-ko` installs the [latest released version of `ko`](https://github.com/google/ko/releases). By default, `ko-build/setup-ko` installs the [latest released version of `ko`](https://github.com/ko-build/ko/releases).
You can select a version with the `version` parameter: You can select a version with the `version` parameter:
```yaml ```yaml
- uses: imjasonh/setup-ko@v0.4 - uses: ko-build/setup-ko@v0.6
with: with:
version: v0.8.0 version: v0.14.1
``` ```
To build and install `ko` from source using `go install`, specify `version: tip`. To build and install `ko` from source using `go install`, specify `version: tip`.
### Pushing to other registries ### 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 as well. By default, `ko-build/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.
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. 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. 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: 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:
``` ```yaml
steps: steps:
... ...
- uses: imjasonh/setup-ko@v0.4 - uses: ko-build/setup-ko@v0.6
env: env:
KO_DOCKER_REPO: my.registry/my-repo KO_DOCKER_REPO: my.registry/my-repo
- env: - env:
auth_token: ${{ secrets.auth_token }} auth_token: ${{ secrets.auth_token }}
run: | run: |
echo "${auth_token}" | ko login https://my.registry --username my-username --password-stdin echo "${auth_token}" | ko login https://my.registry --username my-username --password-stdin
ko publish ./ ko build
``` ```
### Release Integration ### Release Integration
In addition to publishing images, `ko` can produce YAML files containing references to built images, using [`ko resolve`](https://github.com/google/ko#kubernetes-integration) In addition to publishing images, `ko` can produce YAML files containing references to built images, using [`ko resolve`](https://ko.build/features/k8s)
With this action, you can use `ko resolve` to produce output YAML that you then attach to a GitHub Release using the [GitHub CLI](https://cli.github.com). With this action, you can use `ko resolve` to produce output YAML that you then attach to a GitHub Release using the [GitHub CLI](https://cli.github.com).
For example: For example:
@ -82,18 +86,19 @@ name: Publish Release YAML
on: on:
release: release:
types: ['created'] types:
- 'created'
jobs: jobs:
publish-release-yaml: publish-release-yaml:
name: Publish Release YAML name: Publish Release YAML
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/setup-go@v2 - uses: actions/setup-go@v4
with: with:
go-version: 1.15 go-version: '1.20'
- uses: actions/checkout@v2 - uses: actions/checkout@v3
- uses: imjasonh/setup-ko@v0.4 - uses: ko-build/setup-ko@v0.6
- name: Generate and upload release.yaml - name: Generate and upload release.yaml
env: env:
@ -106,6 +111,6 @@ jobs:
### A note on versioning ### A note on versioning
The `@v0.4` in the `uses` statement refers to the version _of the action definition in this repo._ The `@v0.X` in the `uses` statement refers to the version _of the action definition in this repo._
Regardless of what version of the action definition you use, `imjasonh/setup-ko` will install the latest released version of `ko` unless otherwise specified with `version:`. Regardless of what version of the action definition you use, `ko-build/setup-ko` will install the latest released version of `ko` unless otherwise specified with `version:`.

View File

@ -5,7 +5,7 @@ branding:
color: green color: green
inputs: inputs:
version: version:
description: 'Version of ko to install (tip, latest-release, v0.8.2, etc.)' description: 'Version of ko to install (tip, latest-release, v0.14.1, etc.)'
required: true required: true
default: 'latest-release' default: 'latest-release'
runs: runs:
@ -50,6 +50,8 @@ runs:
echo "${{ github.token }}" | ko login ghcr.io --username "dummy" --password-stdin echo "${{ github.token }}" | ko login ghcr.io --username "dummy" --password-stdin
# Set KO_DOCKER_REPO for future steps. # Set KO_DOCKER_REPO for future steps.
echo "KO_DOCKER_REPO=ghcr.io/${{ github.repository }}" # We need to get the repository name in lowercase, otherwise it could fail
echo "KO_DOCKER_REPO=ghcr.io/${{ github.repository }}" >> $GITHUB_ENV repo=$(echo "${{ github.repository }}" | tr '[:upper:]' '[:lower:]')
echo "KO_DOCKER_REPO=ghcr.io/${repo}"
echo "KO_DOCKER_REPO=ghcr.io/${repo}" >> $GITHUB_ENV
fi fi

4
go.mod
View File

@ -1,3 +1,3 @@
module github.com/imjasonh/setup-ko module github.com/ko-build/setup-ko
go 1.16 go 1.22