diff --git a/.github/workflows/snapcraft.yml b/.github/workflows/snapcraft.yml index 5cc09bd..0736470 100644 --- a/.github/workflows/snapcraft.yml +++ b/.github/workflows/snapcraft.yml @@ -4,12 +4,20 @@ on: push: tags: - 'v*.*.*' + pull_request: + paths: + - 'snap/**' + - '.github/workflows/snapcraft.yml' + workflow_dispatch: jobs: build-and-release: runs-on: ubuntu-latest env: - SNAP_VERSION: ${{ github.ref_name }} + # Use the tag as the snap version on tag pushes; otherwise use a dev + # placeholder so non-tag triggers (PRs, manual runs) still produce a + # valid version string. + SNAP_VERSION: ${{ startsWith(github.ref, 'refs/tags/v') && github.ref_name || '0.0.0-dev' }} steps: - uses: actions/checkout@v6 @@ -20,7 +28,10 @@ jobs: run: snapcraft - name: Upload to Snap Store - if: success() + # Only publish on tag pushes. PRs and manual dispatch builds stop + # at the build step so we can iterate on snap/snapcraft.yaml + # without touching the store. + if: startsWith(github.ref, 'refs/tags/v') env: SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAPCRAFT_STORE_CREDENTIALS }} run: snapcraft upload *.snap --release=edge diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index 4b674ff..84ad578 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -1,5 +1,6 @@ name: git-sweep base: core22 +adopt-info: git-sweep summary: Remove local branches whose remote has been deleted (gone) description: | git-sweep is a small, cross-platform CLI that removes local branches whose upstream has been removed.