Skip to content

Commit

Permalink
Merge pull request #68 from rajatjindal/updates
Browse files Browse the repository at this point in the history
update golang/dependencies, move to ghcr
  • Loading branch information
rajatjindal authored Mar 26, 2023
2 parents 758952f + 06b85b6 commit d6f1554
Show file tree
Hide file tree
Showing 669 changed files with 61,396 additions and 16,118 deletions.
11 changes: 7 additions & 4 deletions .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,15 @@ jobs:
TestPR:
runs-on: ubuntu-latest
steps:

- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Setup Go
uses: actions/setup-go@v1
uses: actions/setup-go@v4
with:
go-version: 1.17
go-version: '1.20'

- name: Run unit tests
run: |
go test -mod vendor ./... -cover
pwd && ls -ltr && go version && go test -mod vendor ./... -cover
48 changes: 43 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,61 @@ on:
push:
tags:
- 'v*.*.*'

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
ghcr:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Log in to the Container registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

- name: Build and push Docker image
uses: docker/[email protected]
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

goreleaser:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@master
uses: actions/checkout@v3

- name: Setup Go
uses: actions/setup-go@v1
uses: actions/setup-go@v4
with:
go-version: 1.17
go-version: '1.20'

- name: Run unit tests
run: |
go test -mod vendor ./... -cover
- name: GoReleaser
uses: goreleaser/goreleaser-action@v1
uses: goreleaser/goreleaser-action@v4.2.0
with:
version: latest
args: release --rm-dist
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion .go-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.17.3
1.20
1 change: 1 addition & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ builds:
- amd64

archives:

- builds:
- krew-release-bot
name_template: "{{ .ProjectName }}_{{ .Tag }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}"
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
FROM golang:1.17-alpine3.15 as builder
FROM golang:1.20-alpine3.17 as builder

WORKDIR /go/src/github.com/rajatjindal/krew-release-bot
COPY . .

RUN CGO_ENABLED=0 GOOS=linux go test -mod vendor ./... -cover
RUN CGO_ENABLED=0 GOOS=linux go build -mod vendor --ldflags "-s -w" -o krew-release-bot cmd/action/*

FROM alpine:3.15
FROM alpine:3.17

WORKDIR /home/app

Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ To trigger `krew-release-bot` you can use a `github-action` which sends the even
- To setup the action, add the following snippet after the step that publishes the new release and assets:
```yaml
- name: Update new version in krew-index
uses: rajatjindal/[email protected].43
uses: rajatjindal/[email protected].44
```
Check out the `goreleaser` example below for details.

Expand Down Expand Up @@ -47,7 +47,7 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Update new version in krew-index
uses: rajatjindal/[email protected].43
uses: rajatjindal/[email protected].44
```

\*\* You can also customize the release assets names, platforms for which build is done using .goreleaser.yml file in root of your git repo.
Expand All @@ -64,7 +64,7 @@ jobs:
You can test the template file rendering before check-in to the repo by running following command

```bash
$ docker run -v /path/to/your/template-file.yaml:/tmp/template-file.yaml rajatjindal/krew-release-bot:v0.0.43 \
$ docker run -v /path/to/your/template-file.yaml:/tmp/template-file.yaml ghcr.io/rajatjindal/krew-release-bot:v0.0.44 \
krew-release-bot template --tag <tag-name> --template-file /tmp/template-file.yaml
```

Expand Down
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: "krew-release-bot"
description: "automatically opens PR for upstream krew-index repo when you publish new release of your awesome plugin"
runs:
using: "docker"
image: "docker://rajatjindal/krew-release-bot:v0.0.43"
image: "docker://ghcr.io/rajatjindal/krew-release-bot:v0.0.44"
inputs:
workdir:
description: "Working directory, defaults to env.GITHUB_WORKSPACE"
Expand Down
11 changes: 0 additions & 11 deletions build-and-push.sh

This file was deleted.

4 changes: 2 additions & 2 deletions examples/circleci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ version: 2
jobs:
update-krew-index:
docker:
- image: circleci/golang:1.16
- image: circleci/golang:1.20
environment:
## KREW_RELEASE_BOT_WEBHOOK_URL env helps you test your setup without actually publishing to kubernetes-sigs/krew-index
## remove this env when you are ready for real release

KREW_RELEASE_BOT_WEBHOOK_URL: https://krew-release-bot-dryrun.rajatjindal.com/github-action-webhook
KREW_RELEASE_BOT_VERSION: v0.0.43
KREW_RELEASE_BOT_VERSION: v0.0.44
steps:
- checkout
- run: |
Expand Down
4 changes: 2 additions & 2 deletions examples/travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ env:
sudo: false

script:
- curl -LO https://github.com/rajatjindal/krew-release-bot/releases/download/v0.0.43/krew-release-bot_v0.0.43_linux_amd64.tar.gz
- tar -xvf krew-release-bot_v0.0.43_linux_amd64.tar.gz
- curl -LO https://github.com/rajatjindal/krew-release-bot/releases/download/v0.0.44/krew-release-bot_v0.0.44_linux_amd64.tar.gz
- tar -xvf krew-release-bot_v0.0.44_linux_amd64.tar.gz
- printenv && pwd && ls -ltr
- ./krew-release-bot action
59 changes: 32 additions & 27 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,59 +1,64 @@
module github.com/rajatjindal/krew-release-bot

go 1.17
go 1.20

require (
github.com/aws/aws-lambda-go v1.30.0
github.com/aws/aws-lambda-go v1.39.1
github.com/google/go-github/v29 v29.0.3
github.com/pkg/errors v0.9.1
github.com/sirupsen/logrus v1.8.1
github.com/spf13/cobra v1.4.0
github.com/stretchr/testify v1.7.0
golang.org/x/oauth2 v0.0.0-20220411215720-9780585627b5
gopkg.in/h2non/gock.v1 v1.0.15
github.com/sirupsen/logrus v1.9.0
github.com/spf13/cobra v1.6.1
github.com/stretchr/testify v1.8.2
golang.org/x/oauth2 v0.6.0
gopkg.in/h2non/gock.v1 v1.1.2
gopkg.in/src-d/go-git.v4 v4.13.1
// dont upgrade krew as we use a pkg from this version
// which was made internal with a later version
sigs.k8s.io/krew v0.3.3
)

require (
github.com/Microsoft/go-winio v0.5.2 // indirect
github.com/Microsoft/go-winio v0.6.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/emirpasic/gods v1.18.0 // indirect
github.com/go-logr/logr v1.2.0 // indirect
github.com/emirpasic/gods v1.18.1 // indirect
github.com/go-logr/logr v1.2.3 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/google/go-cmp v0.5.5 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/google/go-cmp v0.5.9 // indirect
github.com/google/go-querystring v1.1.0 // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/h2non/parth v0.0.0-20190131123155-b4df798d6542 // indirect
github.com/inconshreveable/mousetrap v1.0.0 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/kevinburke/ssh_config v1.2.0 // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/sergi/go-diff v1.2.0 // indirect
github.com/sergi/go-diff v1.3.1 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/src-d/gcfg v1.4.0 // indirect
github.com/xanzy/ssh-agent v0.3.1 // indirect
golang.org/x/crypto v0.0.0-20220411220226-7b82a4e95df4 // indirect
golang.org/x/net v0.0.0-20220412020605-290c469a71a5 // indirect
golang.org/x/sys v0.0.0-20220412211240-33da011f77ad // indirect
golang.org/x/text v0.3.7 // indirect
google.golang.org/appengine v1.6.6 // indirect
google.golang.org/protobuf v1.28.0 // indirect
github.com/stretchr/objx v0.5.0 // indirect
github.com/xanzy/ssh-agent v0.3.3 // indirect
golang.org/x/crypto v0.7.0 // indirect
golang.org/x/mod v0.8.0 // indirect
golang.org/x/net v0.8.0 // indirect
golang.org/x/sys v0.6.0 // indirect
golang.org/x/text v0.8.0 // indirect
golang.org/x/tools v0.6.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/protobuf v1.30.0 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/src-d/go-billy.v4 v4.3.2 // indirect
gopkg.in/warnings.v0 v0.1.2 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
k8s.io/apimachinery v0.23.5 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/apimachinery v0.26.3 // indirect
k8s.io/klog v1.0.0 // indirect
k8s.io/klog/v2 v2.30.0 // indirect
k8s.io/utils v0.0.0-20211116205334-6203023598ed // indirect
sigs.k8s.io/json v0.0.0-20211020170558-c049b76a60c6 // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.2.1 // indirect
k8s.io/klog/v2 v2.90.1 // indirect
k8s.io/utils v0.0.0-20230313181309-38a27ef9d749 // indirect
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect
sigs.k8s.io/yaml v1.3.0 // indirect
)
Loading

0 comments on commit d6f1554

Please sign in to comment.