From 1dd37e544577bcde47bd6b411643a9feb848eb98 Mon Sep 17 00:00:00 2001 From: Dmitry Lyfar Date: Sun, 26 Nov 2023 22:12:23 +1300 Subject: [PATCH 1/5] Add snap target with strict confinement Contains additional properties to make the shell commands work from within the strict confinement. JP Desktop uses the SHELL environment variable to launch a shell command and if SHELL is different from what is available in the snap's core (e.g. /usr/bin/zsh), the command would fail. Thus, bash is ensured as the SHELL option --- package.json | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 47a5e828..403e4927 100644 --- a/package.json +++ b/package.json @@ -71,6 +71,7 @@ "afterSign": "scripts/notarize.js", "linux": { "target": [ + "snap", "deb", "rpm" ], @@ -87,6 +88,14 @@ "--after-install=build/linux_after_install.sh" ] }, + "snap": { + "confinement": "strict", + "base": "core22", + "environment": { + "SHELL": "/bin/bash" + }, + "plugs": ["default",{"personal-files":{"interface":"personal-files","write":["$HOME/.jupyter","$HOME/.ipynb_checkpoints","$HOME/.ipython"]}}] + }, "win": { "target": [ "nsis" @@ -215,4 +224,4 @@ "winreg": "^1.2.4", "yargs": "^17.6.2" } -} \ No newline at end of file +} From 19dffcc2094358a7a7ad151340fe9088bcb2f7af Mon Sep 17 00:00:00 2001 From: Dmitry Lyfar Date: Wed, 24 Jan 2024 08:19:26 +1300 Subject: [PATCH 2/5] Adjust GitHub Actions workflows to build and publish snap * The snap's confinement mode is switched to classic. Mostly because JL Server creates hidden and temp files in a jupyter notebook directory it has open (e.g. for checkpoints or when it saves the file). Thus, if a user has a notebook stored in $HOME, JLD fails to save it with a permission denied error. It cannot be resolved with the snap's personal-files interface as the interface allows to specify existing paths only. --- .github/workflows/publish.yml | 37 +++++++++++++++++++++++++++++++++++ package.json | 28 +++++++++++++------------- 2 files changed, 51 insertions(+), 14 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index bde31abb..c694bf1a 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -137,6 +137,15 @@ jobs: name: fedora-installer path: | dist/JupyterLab.rpm + + - name: Upload Snap Installer + if: matrix.cfg.platform == 'linux' + uses: actions/upload-artifact@v4 + id: snap-artifact + with: + name: snap-installer + path: | + dist/JupyterLab.snap - name: Upload macOS x64 Installer if: matrix.cfg.platform == 'osx-64' @@ -241,3 +250,31 @@ jobs: asset_name: latest.yml tag: v${{ steps.package-info.outputs.version}} overwrite: true + + - name: Upload snap installer as Release asset + if: matrix.cfg.platform == 'linux' && steps.release-exists.outputs.result == 'true' + uses: svenstaro/upload-release-action@v2 + with: + repo_token: ${{ secrets.JLAB_APP_TOKEN }} + file: dist/JupyterLab.snap + asset_name: JupyterLab-Setup.snap + tag: v${{ steps.package-info.outputs.version}} + overwrite: true + + - name: Publish snap to the latest/edge channel in Snap Store + if: matrix.cfg.platform == 'linux' + uses: snapcore/action-publish@v1 + env: + SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAPCRAFT_STORE_CREDENTIALS }} + with: + snap: dist/JupyterLab.snap + release: edge + + - name: Publish snap to the latest/stable channel in Snap Store + if: matrix.cfg.platform == 'linux' && steps.release-exists.outputs.result == 'true' + uses: snapcore/action-publish@v1 + env: + SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAPCRAFT_STORE_CREDENTIALS }} + with: + snap: dist/JupyterLab.snap + release: stable diff --git a/package.json b/package.json index 403e4927..0c4989fb 100644 --- a/package.json +++ b/package.json @@ -71,9 +71,9 @@ "afterSign": "scripts/notarize.js", "linux": { "target": [ - "snap", "deb", - "rpm" + "rpm", + "snap" ], "category": "Science;Development;", "extraResources": [ @@ -88,13 +88,21 @@ "--after-install=build/linux_after_install.sh" ] }, + "rpm": { + "depends": [ + "libXScrnSaver" + ], + "fpm": [ + "--after-install=build/linux_after_install.sh" + ] + }, "snap": { - "confinement": "strict", + "confinement": "classic", "base": "core22", "environment": { - "SHELL": "/bin/bash" - }, - "plugs": ["default",{"personal-files":{"interface":"personal-files","write":["$HOME/.jupyter","$HOME/.ipynb_checkpoints","$HOME/.ipython"]}}] + "SHELL": "/bin/bash", + "GTK_USE_PORTAL":"1" + } }, "win": { "target": [ @@ -107,14 +115,6 @@ } ] }, - "rpm": { - "depends": [ - "libXScrnSaver" - ], - "fpm": [ - "--after-install=build/linux_after_install.sh" - ] - }, "nsis": { "oneClick": "false", "artifactName": "${productName}-Setup.${ext}", From cc7448ea1a6af62649be766ed1af3a3b16f126d0 Mon Sep 17 00:00:00 2001 From: Mehmet Bektas Date: Fri, 23 Feb 2024 19:17:46 -0800 Subject: [PATCH 3/5] fix linux platform name --- .github/workflows/publish.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index e25a3884..d17cf561 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -139,7 +139,7 @@ jobs: dist/JupyterLab.rpm - name: Upload Snap Installer - if: matrix.cfg.platform == 'linux' + if: matrix.cfg.platform == 'linux-64' uses: actions/upload-artifact@v4 id: snap-artifact with: @@ -252,7 +252,7 @@ jobs: overwrite: true - name: Upload snap installer as Release asset - if: matrix.cfg.platform == 'linux' && steps.release-exists.outputs.result == 'true' + if: matrix.cfg.platform == 'linux-64' && steps.release-exists.outputs.result == 'true' uses: svenstaro/upload-release-action@v2 with: repo_token: ${{ secrets.JLAB_APP_TOKEN }} @@ -262,7 +262,7 @@ jobs: overwrite: true - name: Publish snap to the latest/edge channel in Snap Store - if: matrix.cfg.platform == 'linux' + if: matrix.cfg.platform == 'linux-64' uses: snapcore/action-publish@v1 env: SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAPCRAFT_STORE_CREDENTIALS }} @@ -271,7 +271,7 @@ jobs: release: edge - name: Publish snap to the latest/stable channel in Snap Store - if: matrix.cfg.platform == 'linux' && steps.release-exists.outputs.result == 'true' + if: matrix.cfg.platform == 'linux-64' && steps.release-exists.outputs.result == 'true' uses: snapcore/action-publish@v1 env: SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAPCRAFT_STORE_CREDENTIALS }} From f67481c641b3688d16dcc3f16cf20c138f22c6cc Mon Sep 17 00:00:00 2001 From: Mehmet Bektas Date: Thu, 7 Mar 2024 19:18:17 -0800 Subject: [PATCH 4/5] dont release snap to stable channel during pre-release --- .github/workflows/publish.yml | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index d17cf561..637f448c 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -269,12 +269,4 @@ jobs: with: snap: dist/JupyterLab.snap release: edge - - - name: Publish snap to the latest/stable channel in Snap Store - if: matrix.cfg.platform == 'linux-64' && steps.release-exists.outputs.result == 'true' - uses: snapcore/action-publish@v1 - env: - SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAPCRAFT_STORE_CREDENTIALS }} - with: - snap: dist/JupyterLab.snap - release: stable + From 0aad0cfecd69a86e60729bf6782bb32626a666a9 Mon Sep 17 00:00:00 2001 From: Mehmet Bektas Date: Fri, 8 Mar 2024 18:45:06 -0800 Subject: [PATCH 5/5] publish to candidate channel at pre-release stage --- .github/workflows/publish.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 637f448c..764ef24b 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -270,3 +270,11 @@ jobs: snap: dist/JupyterLab.snap release: edge + - name: Publish snap to the latest/candidate channel in Snap Store + if: matrix.cfg.platform == 'linux-64' && steps.release-exists.outputs.result == 'true' + uses: snapcore/action-publish@v1 + env: + SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAPCRAFT_STORE_CREDENTIALS }} + with: + snap: dist/JupyterLab.snap + release: candidate