From 330947edc63f855a95c8cc530206d0c87d5c56cc Mon Sep 17 00:00:00 2001 From: Hidetake Iwata Date: Sat, 18 Apr 2026 21:30:26 +0900 Subject: [PATCH] Support immutable releases (#1552) --- .github/workflows/publish.yaml | 14 ++++++++++++++ .github/workflows/release.yaml | 30 +++++++++++++++++++----------- 2 files changed, 33 insertions(+), 11 deletions(-) create mode 100644 .github/workflows/publish.yaml diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml new file mode 100644 index 00000000..a1cdbfff --- /dev/null +++ b/.github/workflows/publish.yaml @@ -0,0 +1,14 @@ +name: publish + +on: + release: + types: + - published + +jobs: + krew: + runs-on: ubuntu-latest + timeout-minutes: 10 + steps: + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + - uses: rajatjindal/krew-release-bot@c970b8a8f6dbc2f2285a26e3ae160903b87002c3 # v0.0.51 diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 14871ea5..344e91ae 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -18,8 +18,25 @@ on: - pkg/** - go.* +concurrency: + cancel-in-progress: true + group: ${{ github.workflow }}--${{ github.ref }} + jobs: + create: + runs-on: ubuntu-slim + timeout-minutes: 10 + outputs: + draft-release-name: ${{ steps.create-draft-release.outputs.draft-release-name }} + permissions: + contents: write + steps: + - if: github.event_name == 'push' + id: create-draft-release + uses: int128/go-release-action/create-draft-release@9e1d6ec29fc6ffc2ba55f631baf4a73017d228e1 # v2.5.0 + build: + needs: create strategy: matrix: platform: @@ -62,17 +79,8 @@ jobs: with: go-version-file: go.mod cache-dependency-path: go.sum - - run: go build -ldflags '-X main.version=${{ github.ref_name }}' + - run: go build -ldflags "-X main.version=$GITHUB_SHA" - uses: int128/go-release-action@9e1d6ec29fc6ffc2ba55f631baf4a73017d228e1 # v2.5.0 with: binary: kubelogin - - publish: - if: github.ref_type == 'tag' - needs: - - build - runs-on: ubuntu-latest - timeout-minutes: 10 - steps: - - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - - uses: rajatjindal/krew-release-bot@c970b8a8f6dbc2f2285a26e3ae160903b87002c3 # v0.0.51 + release-name: ${{ needs.create.outputs.draft-release-name }}