From 8fb8c9f2f263c13f551b672dd183dd226fd77d1b Mon Sep 17 00:00:00 2001 From: Marcos Alano Date: Mon, 25 Dec 2023 05:28:51 -0300 Subject: [PATCH] Add support to publish Snaps using goreleaser (#353) Closes #351. --- .github/workflows/ci.yml | 2 +- .github/workflows/release.yml | 11 +++++++++++ .goreleaser.yml | 17 +++++++++++++++++ 3 files changed, 29 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6a7302f..78dcdfe 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -50,7 +50,7 @@ jobs: uses: goreleaser/goreleaser-action@v2 with: version: latest - args: release --snapshot --skip-publish --rm-dist + args: release --snapshot --skip publish,snapcraft --clean - name: Setup BATS framework run: sudo npm install -g bats - name: kubectx (Go) integration tests diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 35aea87..54fae36 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -27,6 +27,13 @@ jobs: uses: actions/setup-go@v2 with: go-version: '1.20' + - name: Install Snapcraft + uses: samuelmeuli/action-snapcraft@v1 + - name: Setup Snapcraft + run: | + # https://github.com/goreleaser/goreleaser/issues/1715 + mkdir -p $HOME/.cache/snapcraft/download + mkdir -p $HOME/.cache/snapcraft/stage-packages - name: GoReleaser uses: goreleaser/goreleaser-action@v2 with: @@ -42,3 +49,7 @@ jobs: uses: rajatjindal/krew-release-bot@v0.0.38 with: krew_template_file: .krew/ns.yaml + - name: Publish Snaps to the Snap Store (stable channel) + run: for snap in $(ls dist/*.snap); do snapcraft upload --release=stable $snap; done + env: + SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAPCRAFT_TOKEN }} diff --git a/.goreleaser.yml b/.goreleaser.yml index ecfca8d..dec3285 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -98,3 +98,20 @@ release: extra_files: - glob: ./kubens - glob: ./kubectx +snapcrafts: + - id: kubectx + name: kubectx + summary: 'kubectx + kubens: Power tools for kubectl' + description: | + kubectx is a tool to switch between contexts (clusters) on kubectl faster. + kubens is a tool to switch between Kubernetes namespaces (and configure them for kubectl) easily. + grade: stable + confinement: classic + base: core20 + apps: + kubectx: + command: kubectx + completer: completion/kubectx.bash + kubens: + command: kubens + completer: completion/kubens.bash