diff --git a/.dockerignore b/.dockerignore index 87b5c14b..8f266283 100644 --- a/.dockerignore +++ b/.dockerignore @@ -5,6 +5,7 @@ contrib init-scripts package pylintrc +snap *.md !CHANGELOG*.md start.bat diff --git a/.github/workflows/publish-snap.yml b/.github/workflows/publish-snap.yml new file mode 100644 index 00000000..d30a4511 --- /dev/null +++ b/.github/workflows/publish-snap.yml @@ -0,0 +1,94 @@ +name: Publish Snap + +on: + push: + branches: [master, beta, nightly] + tags: [v*] + pull_request: ~ + +jobs: + build-snap: + name: Build Snap Package (${{ matrix.architecture }}) + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + architecture: + - i386 + - amd64 + - arm64 + - armhf + - ppc64le + #- s390x # broken at the moment + steps: + - name: Checkout Code + uses: actions/checkout@v2 + + - name: Prepare + id: prepare + run: | + git fetch --prune --unshallow --tags + if [[ $GITHUB_REF == refs/tags/*-beta || $GITHUB_REF == refs/heads/beta ]]; then + echo ::set-output name=RELEASE::beta + elif [[ $GITHUB_REF == refs/tags/* || $GITHUB_REF == refs/heads/master ]]; then + echo ::set-output name=RELEASE::stable + else + echo ::set-output name=RELEASE::edge + fi + + - name: Set Up QEMU + uses: docker/setup-qemu-action@v1 + + - name: Build Snap Package + uses: diddlesnaps/snapcraft-multiarch-action@v1 + id: build + with: + architecture: ${{ matrix.architecture }} + + - name: Upload Snap Package + uses: actions/upload-artifact@v2 + with: + name: Tautulli-snap-package-${{ matrix.architecture }} + path: ${{ steps.build.outputs.snap }} + + - name: Review Snap Package + uses: diddlesnaps/snapcraft-review-tools-action@v1 + with: + snap: ${{ steps.build.outputs.snap }} + + - name: Publish Snap Package + uses: snapcore/action-publish@v1 + if: > + github.event_name != 'pull_request' && + (startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/nightly') + with: + store_login: ${{ secrets.SNAP_LOGIN }} + snap: ${{ steps.build.outputs.snap }} + release: ${{ steps.prepare.outputs.RELEASE }} + + discord: + name: Discord Notification + needs: build-snap + if: always() && github.event_name != 'pull_request' + runs-on: ubuntu-latest + steps: + - name: Get Build Job Status + uses: technote-space/workflow-conclusion-action@v1 + + - name: Combine Job Status + id: status + run: | + failures=(neutral, skipped, timed_out, action_required) + if [[ ${array[@]} =~ $WORKFLOW_CONCLUSION ]]; then + echo ::set-output name=status::failure + else + echo ::set-output name=status::$WORKFLOW_CONCLUSION + fi + + - name: Post Status to Discord + uses: sarisia/actions-status-discord@v1 + with: + webhook: ${{ secrets.DISCORD_WEBHOOK }} + status: ${{ steps.status.outputs.status }} + title: ${{ github.workflow }} + nofail: true diff --git a/.gitignore b/.gitignore index e55fd0af..c868b447 100644 --- a/.gitignore +++ b/.gitignore @@ -81,3 +81,16 @@ _ReSharper*/ #Ignore files generated by pyinstaller /build /dist + +#snapcraft specifics +/parts/ +/stage/ +/prime/ + +*.snap + +.snapcraft +__pycache__ +*.pyc +*_source.tar.bz2 +snap/.snapcraft \ No newline at end of file diff --git a/Tautulli.py b/Tautulli.py index 0a15f2c6..4fa83243 100755 --- a/Tautulli.py +++ b/Tautulli.py @@ -124,6 +124,8 @@ def main(): if helpers.bool_true(os.getenv('TAUTULLI_DOCKER', False)): plexpy.DOCKER = True + if helpers.bool_true(os.getenv('TAUTULLI_SNAP', False)): + plexpy.SNAP = True if args.dev: plexpy.DEV = True diff --git a/data/interfaces/default/base.html b/data/interfaces/default/base.html index d466536f..14bfcd6a 100644 --- a/data/interfaces/default/base.html +++ b/data/interfaces/default/base.html @@ -59,6 +59,8 @@ % endif % if plexpy.INSTALL_TYPE == 'docker': Update your Docker container or Dismiss + % elif plexpy.INSTALL_TYPE == 'snap': + Update your Snap package or Dismiss % elif plexpy.INSTALL_TYPE in ('windows', 'macos'): Download and install the latest version or Dismiss % else: @@ -337,6 +339,8 @@ ${next.modalIncludes()} } if (result.install_type === 'docker') { msg += 'Update your Docker container or Dismiss'; + } else if (result.install_type === 'snap') { + msg += 'Update your Snap package or Dismiss'; } else if (result.install_type === 'windows' || result.install_type === 'macos') { msg += 'Download and install the latest version or Dismiss' } else { diff --git a/data/interfaces/default/settings.html b/data/interfaces/default/settings.html index 6aaebc9c..b0cd9170 100644 --- a/data/interfaces/default/settings.html +++ b/data/interfaces/default/settings.html @@ -220,7 +220,7 @@

Check for Tautulli updates periodically.

- % if not plexpy.FROZEN: + % if not plexpy.SNAP and not plexpy.FROZEN: