jobs:
  build:
    runs-on: '${{ matrix.system.image }}'
    steps:
      - uses: 'actions/checkout@v6'
      - id: 'build'
        name: 'Build Snap package'
        uses: 'snapcore/action-build@v1'
        with:
          snapcraft-args: 'pack'
          snapcraft-channel: 'latest/stable'
      - name: 'Upload Artifacts'
        uses: 'actions/upload-artifact@v7'
        with:
          if-no-files-found: 'error'
          name: 'wiswa-snap-${{ matrix.system.arch }}'
          path: '*.snap'
      - name: 'Attest'
        uses: 'actions/attest@v4'
        with:
          subject-path: '*.snap'
      - if: "github.ref_type == 'tag'"
        name: 'Upload package'
        uses: 'softprops/action-gh-release@v2'
        with:
          draft: true
          fail_on_unmatched_files: true
          files: '*.snap'
    strategy:
      matrix:
        system:
          - arch: 'amd64'
            image: 'ubuntu-24.04'
          - arch: 'arm64'
            image: 'ubuntu-24.04-arm'
name: 'Snap'
'on':
  push:
    branches:
      - 'master'
    paths:
      - '**/*.py'
      - '**/*.pyi'
      - '.github/workflows/snap.yml'
      - 'pyproject.toml'
      - 'snapcraft.yaml'
      - 'uv.lock'
      - 'poetry.lock'
    tags:
      - 'v*.*.*'
  workflow_dispatch: null
permissions:
  attestations: 'write'
  contents: 'write'
  id-token: 'write'
