Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix kubectl plugin release #13157

Open
wants to merge 12 commits into
base: main
Choose a base branch
from
25 changes: 15 additions & 10 deletions .github/workflows/plugin.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ permissions:
jobs:
release-plugin:
runs-on: ubuntu-latest
if: ${{ startsWith(github.ref, 'refs/tags/controller-') }}
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
Expand All @@ -25,26 +26,30 @@ jobs:
go-version: ${{ env.GOLANG_VERSION }}
check-latest: true

- name: Run GoReleaser Snapshot
if: ${{ ! startsWith(github.ref, 'refs/tags/') }}
- name: Set a SemVer tag for goreleaser
run: echo "GORELEASER_CURRENT_TAG=${{ github.ref }}" | sed 's/refs\/tags\/controller-//' >> $GITHUB_ENV

# GoReleaser requires a SemVer tag to be present in the git repository
- name: Create a local SemVer tag
run: git tag "${{ env.GORELEASER_CURRENT_TAG }}"

- name: Run GoReleaser
uses: goreleaser/goreleaser-action@9c156ee8a17a598857849441385a2041ef570552 # v6.3.0
with:
version: "~> v2"
args: release --snapshot --clean
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GORELEASER_CURRENT_TAG: ${{ env.GORELEASER_CURRENT_TAG }}

- name: Run GoReleaser
if: ${{ startsWith(github.ref, 'refs/tags/') }}
uses: goreleaser/goreleaser-action@9c156ee8a17a598857849441385a2041ef570552 # v6.3.0
- name: Upload artifacts to release
uses: softprops/action-gh-release@c95fe1489396fe8a9eb87c0abf8aa5b2ef267fda # v2.2.1
with:
version: "~> v2"
args: release --clean
files: dist/kubectl-ingress-nginx_*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Update new version in krew-index
if: ${{ startsWith(github.ref, 'refs/tags/') }}
uses: rajatjindal/krew-release-bot@3d9faef30a82761d610544f62afddca00993eef9 # v0.0.47
with:
krew_template_file: cmd/plugin/krew.yaml
krew_template_file: dist/krew/ingress-nginx.yaml
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,6 @@ cmd/plugin/release/LICENSE
tmp/
test/junitreports/
tests/__snapshot__

# goreleaser artifacts
dist/
25 changes: 20 additions & 5 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
version: 2

project_name: ingress-nginx

release:
github:
owner: kubernetes
name: ingress-nginx
# Disable uploading release assets to GitHub as it requires SemVer tags
disable: true

builds:
- id: ingress-nginx
goos:
Expand All @@ -21,9 +24,21 @@ builds:
-s -w
-X k8s.io/ingress-nginx/version.COMMIT={{ .Commit }}
-X k8s.io/ingress-nginx/version.RELEASE={{ .Tag }}

archives:
- id: ingress-nginx
builds:
ids:
- ingress-nginx
name_template: "kubectl-{{ .ProjectName }}_{{ .Os }}_{{ .Arch }}"
format: tar.gz
formats:
- tar.gz

checksum:
name_template: "kubectl-{{ .ProjectName }}_checksums.txt"

krews:
- skip_upload: true
homepage: "https://kubernetes.github.io/ingress-nginx/kubectl-plugin/"
description: "The official kubectl plugin for ingress-nginx."
short_description: "Interact with ingress-nginx"
url_template: "http://github.com/kubernetes/ingress-nginx/releases/download/controller-{{ .Tag }}/{{ .ArtifactName }}"
41 changes: 0 additions & 41 deletions cmd/plugin/krew.yaml

This file was deleted.