diff --git a/.github/workflows/snap.yaml b/.github/workflows/snap.yaml new file mode 100644 index 0000000..96ebc61 --- /dev/null +++ b/.github/workflows/snap.yaml @@ -0,0 +1,48 @@ +name: snap +on: + push: + tags: + - '*' + branches: + - main + pull_request: + branches: + - main + workflow_dispatch: + +jobs: + build: + runs-on: ubuntu-latest + outputs: + snap-file: ${{ steps.build-snap.outputs.snap }} + steps: + - uses: actions/checkout@v3 + - uses: snapcore/action-build@v1 + id: build-snap + + # Make sure the snap is installable + - run: | + sudo snap install --dangerous ${{ steps.build-snap.outputs.snap }} + # Do some testing with the snap + - run: | + opcua-client --version + - uses: actions/upload-artifact@v3 + with: + name: opcua-client-pkg + 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: opcua-client-pkg + path: . + - uses: snapcore/action-publish@v1 + env: + SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.STORE_LOGIN }} + with: + snap: ${{needs.build.outputs.snap-file}} + release: ${{ startsWith(github.ref, 'refs/tags/') && 'candidate' || 'edge'}} \ No newline at end of file