name: BuildSnap
on:
  workflow_dispatch:

env:
  GH_AUTH: ${{ secrets.GH_AUTH }}
  GH_USER: ${{ secrets.GH_USER }}

jobs:
  build-snap:
    runs-on: ubuntu-20.04
    steps:
      - uses: actions/checkout@v3
      - run: git fetch --prune --unshallow
      - uses: ./.github/workflows/setupgo118amd64
        with:
          user: ${{ secrets.GH_USER }}
          pat: ${{ secrets.GH_AUTH }}
      - run: sudo snap install snapcraft --channel=7.x/stable --classic
      - run: snapcraft --destructive-mode
      - uses: actions/upload-artifact@v3
        with:
          name: candid-snap
          path: ./*.snap
          if-no-files-found: error
