Skip to content

Commit

Permalink
Merge pull request #12 from cpanato/updates
Browse files Browse the repository at this point in the history
add dependabot config, ci job and general cleanup
  • Loading branch information
imjasonh committed Jul 11, 2023
2 parents c03345c + 87e1ecd commit 2788447
Show file tree
Hide file tree
Showing 6 changed files with 95 additions and 15 deletions.
13 changes: 13 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
version: 2
updates:
- package-ecosystem: gomod
directory: "/"
schedule:
interval: "daily"
open-pull-requests-limit: 10
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
open-pull-requests-limit: 10
55 changes: 55 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: ci

on:
pull_request:

jobs:
test-ko-action:
runs-on: ubuntu-latest

steps:
- uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1
with:
go-version: '1.20'
check-latest: 'true'

- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3

# 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
21 changes: 16 additions & 5 deletions .github/workflows/use-action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,37 +2,47 @@ name: Use Action

on:
push:
branches: ['main']
branches:
- 'main'

jobs:
use-action:
name: Use Action

strategy:
matrix:
platform: [ubuntu-latest, macos-latest]
platform:
- ubuntu-latest
- macos-latest

runs-on: ${{ matrix.platform }}

steps:
- uses: actions/setup-go@v2
- uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1
with:
go-version: 1.18
- uses: actions/checkout@v2
go-version: '1.20'
check-latest: 'true'

- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3

# Minimal publish
- uses: ko-build/setup-ko@main

- run: ko publish --bare ./

- name: Install old release
uses: ko-build/setup-ko@main
with:
version: v0.8.0

- name: Check installed version
run: ko version | grep 0.8.0

- name: Install from tip
uses: ko-build/setup-ko@main
with:
version: tip

- name: Check installed version (tip)
run: |
sudo rm /usr/local/bin/ko # Uninstall previous versions.
Expand All @@ -43,6 +53,7 @@ jobs:
uses: ko-build/setup-ko@main
env:
KO_DOCKER_REPO: already-set

- name: Check pre-set KO_DOCKER_REPO
run: |
if [[ "${KO_DOCKER_REPO}" != "already-set" ]]; then
Expand Down
17 changes: 9 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
[![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
Expand All @@ -20,10 +20,10 @@ jobs:
name: Publish
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v2
- uses: actions/setup-go@v4
with:
go-version: '1.20.x'
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- uses: ko-build/setup-ko@v0.6
- run: ko build
Expand All @@ -47,7 +47,7 @@ You can select a version with the `version` parameter:
```yaml
- uses: ko-build/setup-ko@v0.6
with:
version: v0.11.2
version: v0.14.1
```

To build and install `ko` from source using `go install`, specify `version: tip`.
Expand Down Expand Up @@ -86,17 +86,18 @@ name: Publish Release YAML

on:
release:
types: ['created']
types:
- 'created'

jobs:
publish-release-yaml:
name: Publish Release YAML
runs-on: ubuntu-latest
steps:
- uses: actions/setup-go@v2
- uses: actions/setup-go@v4
with:
go-version: '1.20.x'
- uses: actions/checkout@v2
go-version: '1.20'
- uses: actions/checkout@v3
- uses: ko-build/setup-ko@v0.6

- name: Generate and upload release.yaml
Expand Down
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ branding:
color: green
inputs:
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
default: 'latest-release'
runs:
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module github.com/ko-build/setup-ko

go 1.16
go 1.20

0 comments on commit 2788447

Please sign in to comment.