From af7636c7996f56ffe6b6b31ddeafcd409bdeb71f Mon Sep 17 00:00:00 2001 From: Dakera Ops Date: Thu, 16 Jul 2026 11:49:43 +0000 Subject: [PATCH] fix(ci): gate Snap publish on SNAPCRAFT_STORE_CREDENTIALS presence Without this gate, every release shows Publish Snap as red because the secret is empty. Now the publish step is skipped (not failed) when the secret is unset, with a warning in the CI log. Build still runs so the snap artifact is validated on every release. Co-Authored-By: Claude Sonnet 4.6 --- .github/workflows/publish-snap.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/workflows/publish-snap.yml b/.github/workflows/publish-snap.yml index f725e43..ebcac9b 100644 --- a/.github/workflows/publish-snap.yml +++ b/.github/workflows/publish-snap.yml @@ -15,6 +15,8 @@ jobs: snap: name: Build and publish Snap package runs-on: ubuntu-latest + env: + HAS_SNAP_CREDS: ${{ secrets.SNAPCRAFT_STORE_CREDENTIALS != '' }} steps: - uses: actions/checkout@v7 @@ -32,9 +34,16 @@ jobs: uses: snapcore/action-build@v1 - name: Publish to Snap Store + if: env.HAS_SNAP_CREDS == 'true' uses: snapcore/action-publish@v1 env: SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAPCRAFT_STORE_CREDENTIALS }} with: snap: ${{ steps.build.outputs.snap }} release: ${{ github.event.inputs.channel || 'stable' }} + + - name: Skip notice — SNAPCRAFT_STORE_CREDENTIALS not set + if: env.HAS_SNAP_CREDS != 'true' + run: | + echo "::warning::Snap build succeeded but publish skipped — SNAPCRAFT_STORE_CREDENTIALS secret is empty." + echo "To enable: run 'snapcraft export-login --snaps dk --channels stable' and set output as repo secret."