Skip to content

Commit 99505a5

Browse files
[Build][kubectl-plugin] Add release script for kubectl plugin (#2407)
* [Build][kubectl-plugin] Add release script for kubectl plugin Closes: #2406 Signed-off-by: Chi-Sheng Liu <[email protected]> * [Chore] Add comments to explain why krew-release-bot does not work now Closes: #2406 Signed-off-by: Chi-Sheng Liu <[email protected]> --------- Signed-off-by: Chi-Sheng Liu <[email protected]>
1 parent 84839a8 commit 99505a5

File tree

6 files changed

+109
-5
lines changed

6 files changed

+109
-5
lines changed

.github/workflows/release.yaml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: release
2+
on:
3+
push:
4+
tags:
5+
- "v*.*.*"
6+
workflow_dispatch:
7+
jobs:
8+
release-kubectl-plugin:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Checkout
12+
uses: actions/checkout@master
13+
- name: Setup Go
14+
uses: actions/setup-go@v5
15+
with:
16+
go-version: '1.22'
17+
- name: GoReleaser
18+
uses: goreleaser/goreleaser-action@v6
19+
with:
20+
distribution: 'goreleaser'
21+
version: latest
22+
args: release --clean
23+
workdir: 'kubectl-plugin'
24+
env:
25+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
26+
# TODO(MortalHappiness): This won't work now. The first version of plugin has to be submitted manually by use to the krew-index repo, so I'll submit a PR to the krew-index repo once a release candidate is created.
27+
- name: Update new version in krew-index
28+
uses: rajatjindal/[email protected]

.krew.yaml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
apiVersion: krew.googlecontainertools.github.com/v1alpha2
2+
kind: Plugin
3+
metadata:
4+
name: ray
5+
spec:
6+
version: {{ .TagName }}
7+
homepage: https://github.com/ray-project/kuberay/kubectl-plugin
8+
platforms:
9+
- selector:
10+
matchLabels:
11+
os: darwin
12+
arch: amd64
13+
{{addURIAndSha "https://github.com/ray-project/kuberay/releases/download/{{ .TagName }}/kubectl-ray_{{ .TagName }}_darwin_amd64.tar.gz" .TagName }}
14+
bin: kubectl-ray
15+
- selector:
16+
matchLabels:
17+
os: darwin
18+
arch: arm64
19+
{{addURIAndSha "https://github.com/ray-project/kuberay/releases/download/{{ .TagName }}/kubectl-ray_{{ .TagName }}_darwin_arm64.tar.gz" .TagName }}
20+
bin: kubectl-ray
21+
- selector:
22+
matchLabels:
23+
os: linux
24+
arch: amd64
25+
{{addURIAndSha "https://github.com/ray-project/kuberay/releases/download/{{ .TagName }}/kubectl-ray_{{ .TagName }}_linux_amd64.tar.gz" .TagName }}
26+
bin: kubectl-ray
27+
- selector:
28+
matchLabels:
29+
os: linux
30+
arch: arm64
31+
{{addURIAndSha "https://github.com/ray-project/kuberay/releases/download/{{ .TagName }}/kubectl-ray_{{ .TagName }}_linux_arm64.tar.gz" .TagName }}
32+
bin: kubectl-ray
33+
shortDescription: Ray kubectl plugin
34+
description: |
35+
Kubectl plugin/extension for Kuberay CLI that provides the ability to manage ray resources.
36+
Read more documentation at: https://github.com/ray-project/kuberay/tree/master/kubectl-plugin

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ repos:
1010
- id: end-of-file-fixer
1111
- id: check-yaml
1212
args: [--allow-multiple-documents]
13-
exclude: ^helm-chart/|^mkdocs.yml$|^benchmark/perf-tests/
13+
exclude: ^helm-chart/|^mkdocs\.yml$|^benchmark/perf-tests/|^\.krew\.yaml$
1414
- id: check-added-large-files
1515
- id: check-merge-conflict
1616
- id: check-case-conflict

docs/development/release.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -128,10 +128,8 @@ Now, we have the Docker images and Helm charts for v0.5.0.
128128
129129
#### Step 8. Generate release
130130
131-
* Click "Create release" to create release for the tag v0.5.0 ([link](https://github.com/ray-project/kuberay/tags)).
132-
* Update `VERSION` in the [Makefile](https://github.com/ray-project/kuberay/blob/master/cli/Makefile) to `vX.Y.Z`.
133-
* Run `make release` in cli folder and generate `kuberay-$VERSION-darwin-amd64.zip` and `kuberay-$VERSION-linux-amd64.zip` files. Upload them to the GitHub release.
134-
* Follow the [instructions](../release/changelog.md) to generate release notes and add notes in the GitHub release.
131+
* Currently, a GitHub release will be generated by CI automatically if a semver tag is pushed to the repository.
132+
* Follow the [instructions](../release/changelog.md) to generate release notes and add notes in the GitHub release.
135133
136134
#### Step 9. Announce the release on the KubeRay slack!
137135

kubectl-plugin/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
11
kubectl-ray
2+
3+
dist/

kubectl-plugin/.goreleaser.yaml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
version: 2
2+
3+
before:
4+
hooks:
5+
- go mod tidy
6+
7+
builds:
8+
- env:
9+
- CGO_ENABLED=0
10+
goos:
11+
- linux
12+
- darwin
13+
goarch:
14+
- amd64
15+
- arm64
16+
main: ./cmd
17+
binary: kubectl-ray
18+
19+
archives:
20+
- format: tar.gz
21+
# this name template makes the OS and Arch compatible with the results of `uname`.
22+
name_template: >-
23+
{{ .Binary }}_
24+
{{- .Tag }}_
25+
{{- .Os }}_
26+
{{- if eq .Arch "amd64" }}amd64
27+
{{- else if eq .Arch "386" }}i386
28+
{{- else }}{{ .Arch }}{{ end }}
29+
{{- if .Arm }}v{{ .Arm }}{{ end }}
30+
# use zip for windows archives
31+
format_overrides:
32+
- goos: windows
33+
format: zip
34+
35+
changelog:
36+
sort: asc
37+
filters:
38+
exclude:
39+
- "^docs:"
40+
- "^test:"

0 commit comments

Comments
 (0)