Skip to content
This repository has been archived by the owner on Aug 12, 2020. It is now read-only.

Commit

Permalink
add readme, use docker image
Browse files Browse the repository at this point in the history
  • Loading branch information
rajatjindal committed Oct 5, 2019
1 parent db921cc commit 21cbd29
Show file tree
Hide file tree
Showing 2 changed files with 94 additions and 17 deletions.
101 changes: 89 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,98 @@
# Hello world docker action
# krew-plugin-release

This action prints "Hello World" or "Hello" + the name of a person to greet to the log.
`krew-plugin-release` is a [github action](https://github.com/features/actions) that opens a PR with upstream [krew-index](https://github.com/kubernetes-sigs/krew-index) on new release of your plugin.

## Inputs
# Installing
#### create token
- Navigate to [tokens](https://github.com/settings/tokens)
- Click on 'Generate new token'
- Choose a name e.g. `krew-plugin-release-token`
- Select `repo.public_repo` checkbox
- Generate and copy token
#### add secret to plugin repo
- Navigate to your github repo that has plugin code
- Go to Settings
- Click on `Secrets` on left nav bar
- Click on 'Add new secret'
- Give name of the secret to be `KREW_PLUGIN_RELEASE_TOKEN` (Note: this has to exactly same like this)
- Add the token you created above and save the secret

### `who-to-greet`
#### create a .krew.yaml file in your plugin git repository.
Below is the file created for [modify-secret](https://github.com/rajatjindal/kubectl-modify-secret). Note that this is a template file, and you can templatize your download uri. The action will process template, fetch the `.tar.gz` file from processed uri, calculate sha, writes the processed plugin manifest and then opens PR in the `krew-index` repo with these changes.

**Required** The name of the person to greet. Default `"World"`.
Look at this [sample PR](https://github.com/rajatjin/krew-index/pulls/3) created using this action.

## Outputs
```yaml
apiVersion: krew.googlecontainertools.github.com/v1alpha2
kind: Plugin
metadata:
name: modify-secret
spec:
version: "{{ .TagName }}"
platforms:
- selector:
matchLabels:
os: darwin
arch: amd64
{{addURIAndSha "https://github.com/rajatjindal/kubectl-modify-secret/releases/download/{{ .TagName }}/darwin-amd64-{{ .TagName }}.tar.gz" .TagName }}
files:
- from: "*"
to: "."
bin: kubectl-modify-secret
- selector:
matchLabels:
os: linux
arch: amd64
{{addURIAndSha "https://github.com/rajatjindal/kubectl-modify-secret/releases/download/{{ .TagName }}/linux-amd64-{{ .TagName }}.tar.gz" .TagName }}
files:
- from: "*"
to: "."
bin: kubectl-modify-secret
shortDescription: modify secret with implicit base64 translations
caveats: |
Usage:
kubectl modify-secret secret-name -n kube-system
Read the documentation at:
https://github.com/rajatjindal/kubectl-modify-secret
description: |
Usage:
kubectl modify-secret secret-name -n kube-system
### `time`
This plugin fetches the given secret manifest from the cluster, decodes
the payload, opens an editor to make changes, and applies the modified
manifest when done.
homepage: https://github.com/rajatjindal/kubectl-modify-secret
```
The time we greeted you.
#### Add following file to your .github/workflows dir
## Example usage
Add the following file, and change the plugin name to your plugin name.
```yaml
name: main
on:
release:
types: ["published"]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Open PR for new release of Krew Plugin
uses: rajatjindal/[email protected]
with:
plugin-name: 'your-plugin-name'
upstream-krew-index-owner: 'kubernetes-sigs'
env:
KREW_PLUGIN_RELEASE_TOKEN: ${{ secrets.KREW_PLUGIN_RELEASE_TOKEN }}
```
# Bug Reports
if you find any issue with this action, please report an issue, and we will try to fix it asap.
# Security Issue
if you find any security issue with this action, please email to rajatjindal83 at gmail dot com
uses: actions/hello-world-docker-action@v1
with:
who-to-greet: 'Mona the Octocat'
10 changes: 5 additions & 5 deletions action.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# action.yml
name: 'Hello World'
description: 'Greet someone and record the time'
name: 'krew-plugin-release'
description: 'automatically opens PR for upstream krew-index repo when you publish new release of your awesome plugin'
inputs:
plugin-name:
description: 'plugin name, defaults to git repo name where this action is triggered'
description: 'plugin-name'
required: true
upstream-krew-index-owner:
description: 'the owner of upstream krew-index repo'
Expand All @@ -14,7 +14,7 @@ outputs:
description: 'The time we greeted you'
runs:
using: 'docker'
image: 'Dockerfile'
image: 'rajatjindal/krew-plugin-release:v0.0.20'
args:
- ${{ inputs.who-to-greet }}
- ${{ inputs.upstream-krew-index-owner }}
- ${{ inputs.plugin-name }}

0 comments on commit 21cbd29

Please sign in to comment.