Skip to content
Open
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@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
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@e435ccd777264be153ace6237001ef4d979d3a7a # v6.4.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@e435ccd777264be153ace6237001ef4d979d3a7a # v6.4.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.