From 05f34fd1357f998f7ea577202e8772f191f4bdef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan-Otto=20Kr=C3=B6pke?= Date: Sat, 10 Oct 2026 20:17:40 +0200 Subject: [PATCH] ci: fix release asset publishing (#2664) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Claude Fable 5 Signed-off-by: Jan-Otto Kröpke --- .github/workflows/ci.yml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d721b3b0..2c0e7da7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -380,7 +380,11 @@ jobs: annotations: ${{ steps.meta.outputs.labels }} publish: - if: github.repository == 'prometheus-community/windows_exporter' && startsWith(github.ref, 'refs/tags/') + # Publishing a release fires both a tag push and a release:published run for + # the same tag. Upload only from the release run: it is the only one where + # the release is guaranteed to exist, and uploading from both runs would + # race on the same asset names. + if: github.repository == 'prometheus-community/windows_exporter' && github.event_name == 'release' runs-on: ubuntu-26.04 needs: - package @@ -396,6 +400,8 @@ jobs: - name: Publish Artifacts env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # The job runs without a checkout, so gh cannot infer the repository. + GH_REPO: ${{ github.repository }} run: | gh release upload "$GITHUB_REF_NAME" \ windows_exporter-*.exe \ @@ -1729,6 +1735,9 @@ jobs: super-linter: name: Super Linter + # Super Linter cannot derive the commit range VALIDATE_ALL_CODEBASE=false + # needs from release events; the tag push run already lints the same commit. + if: github.event_name != 'release' runs-on: ubuntu-26.04 permissions: contents: read