Strange error when attempting to publish via the snapcore/action-publish GitHub Action

Hello, I almost got my built snap image publishing to the snapstore entirely with GitHub Actions. However, I ran into this odd error message. Wondering if this is a known bug or a common mistake on my part?

Hi @postmodern,

I followed up in the github issue.

1 Like

Thank you @mr_cal for the help. To recap the problem in case anyone else runs into the same issue, I copied and pasted pieces of the YAML configuration from the example in the tutorial on ubuntu.com. However, I forgot to copy this key bit of configuration which defines the build.outputs.snap-file variable which is needed by ${{ needs.build.output.snap-file }} to get the file name of the previously built snap file.

name: Snapcraft

on: [ push ]

jobs:
  build:
    runs-on: ubuntu-latest
    outputs:
      snap-file: ${{ steps.build-snap.outputs.snap }} # <---- important
    steps:
    - uses: actions/checkout@v4
    - uses: snapcore/action-build@v1
      id: build-snap
    - run: |
        sudo snap install --devmode --dangerous ${{ steps.build-snap.outputs.snap }}
    - uses: actions/upload-artifact@v3
      with:
        name: ronin.snap
        path: ${{ steps.build-snap.outputs.snap }}

  publish:
    if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/')
    runs-on: ubuntu-latest
    needs: build
    steps:
    - uses: actions/download-artifact@v3
      with:
        name: ronin.snap
        path: .
    - uses: snapcore/action-publish@v1
      env:
        SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAPCRAFT_TOKEN }}
      with:
        snap: ${{ needs.build.outputs.snap-file }}
        release: ${{ startsWith(github.ref, 'refs/tags/') && 'candidate' || 'edge'}}
1 Like