diff --git a/.github/workflows/build-electron.yml b/.github/workflows/build-electron.yml index b5519d9e..84543517 100644 --- a/.github/workflows/build-electron.yml +++ b/.github/workflows/build-electron.yml @@ -48,6 +48,10 @@ jobs: node_modules packages/electron/node_modules key: ${{ runner.os }}-${{ hashFiles('**/package-lock.json') }} + - name: Install Flatpak build tools + run: | + sudo apt install flatpak flatpak-builder + flatpak remote-add --if-not-exists --user flathub https://flathub.org/repo/flathub.flatpakrepo - name: Install dependencies run: | npm i -g npm@8.2.0 @@ -55,6 +59,7 @@ jobs: - name: Build run: | npm run electron:build + npm run electron:build:flatpak env: PL_PWA_URL: ${{ secrets.PL_PWA_URL }} - name: Archive AppImage @@ -63,6 +68,24 @@ jobs: name: padloc-linux-${{ github.sha }}-unsigned.AppImage path: packages/electron/dist/*.AppImage if-no-files-found: error + - name: Archive deb + uses: actions/upload-artifact@v2 + with: + name: padloc-linux-${{ github.sha }}-unsigned.deb + path: packages/electron/dist/*.deb + if-no-files-found: error + - name: Archive snap + uses: actions/upload-artifact@v2 + with: + name: padloc-linux-${{ github.sha }}-unsigned.snap + path: packages/electron/dist/*.snap + if-no-files-found: error + - name: Archive flatpak + uses: actions/upload-artifact@v2 + with: + name: padloc-linux-${{ github.sha }}-unsigned.flatpak + path: packages/electron/dist/*.flatpak + if-no-files-found: error - name: Archive Unpacked uses: actions/upload-artifact@v2 with: diff --git a/.github/workflows/publish-release.yml b/.github/workflows/publish-release.yml index da0294fe..e248d14b 100644 --- a/.github/workflows/publish-release.yml +++ b/.github/workflows/publish-release.yml @@ -268,6 +268,11 @@ jobs: if: matrix.platform == 'macos-latest' run: | brew install coreutils + - name: Install Flatpak build tools + if: matrix.platform == 'ubuntu-latest' + run: | + sudo apt install -y flatpak flatpak-builder + flatpak remote-add --if-not-exists --user flathub https://flathub.org/repo/flathub.flatpakrepo - name: Install dependencies run: | npm i -g npm@8.2.0 @@ -283,6 +288,14 @@ jobs: PL_MACOS_NOTARIZE_PASSWORD: ${{ secrets.PL_MACOS_NOTARIZE_PASSWORD }} GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} EP_PRE_RELEASE: true + - name: Build Flatpak + if: matrix.platform == 'ubuntu-latest' + run: | + npm run electron:build:flatpak + env: + PL_PWA_URL: ${{ secrets.PL_PWA_URL }} + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + EP_PRE_RELEASE: true - name: Generate checksum (AppImage) if: matrix.platform == 'ubuntu-latest' run: | @@ -297,6 +310,48 @@ jobs: file: packages/electron/dist/sha256sum-appimage.txt asset_name: sha256sum-electron-appimage.txt prerelease: true + - name: Generate checksum (deb) + if: matrix.platform == 'ubuntu-latest' + run: | + cd packages/electron/dist + sha256sum *.deb > sha256sum-deb.txt + - name: Upload checksum (deb) + if: matrix.platform == 'ubuntu-latest' + uses: svenstaro/upload-release-action@2.2.1 + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + tag: "v${{ env.PL_VENDOR_VERSION }}" + file: packages/electron/dist/sha256sum-deb.txt + asset_name: sha256sum-electron-deb.txt + prerelease: true + - name: Generate checksum (snap) + if: matrix.platform == 'ubuntu-latest' + run: | + cd packages/electron/dist + sha256sum *.snap > sha256sum-snap.txt + - name: Upload checksum (snap) + if: matrix.platform == 'ubuntu-latest' + uses: svenstaro/upload-release-action@2.2.1 + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + tag: "v${{ env.PL_VENDOR_VERSION }}" + file: packages/electron/dist/sha256sum-snap.txt + asset_name: sha256sum-electron-snap.txt + prerelease: true + - name: Generate checksum (flatpak) + if: matrix.platform == 'ubuntu-latest' + run: | + cd packages/electron/dist + sha256sum *.flatpak > sha256sum-flatpak.txt + - name: Upload checksum (flatpak) + if: matrix.platform == 'ubuntu-latest' + uses: svenstaro/upload-release-action@2.2.1 + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + tag: "v${{ env.PL_VENDOR_VERSION }}" + file: packages/electron/dist/sha256sum-flatpak.txt + asset_name: sha256sum-electron-flatpak.txt + prerelease: true - name: Generate checksum (dmg) if: matrix.platform == 'macos-latest' run: | diff --git a/.gitignore b/.gitignore index c6e9920f..79422c1d 100644 --- a/.gitignore +++ b/.gitignore @@ -28,3 +28,4 @@ packages/extension/dist packages/tauri/dist packages/tauri/src-tauri/icons packages/tauri/tauri-update.json +.flatpak-builder diff --git a/.prettierignore b/.prettierignore index 693a2281..3848f4f5 100644 --- a/.prettierignore +++ b/.prettierignore @@ -12,3 +12,4 @@ packages/tauri/tauri-update.json packages/pwa/dist/**/* package-lock.json cypress/fixtures/**/* +.flatpak-builder/**/* diff --git a/assets/manifest.json b/assets/manifest.json index 6b8d4fcd..29692fb2 100644 --- a/assets/manifest.json +++ b/assets/manifest.json @@ -1,7 +1,7 @@ { "name": "Padloc", "background_color": "#ffffff", - "description": "A modern password manager for indviduals and teams", + "description": "A modern password manager for individuals and teams", "appId": "app.padloc", "scheme": "padloc", "author": "Martin Kleinschrodt ", diff --git a/cypress/integration/03 - v3-compatibility.ts b/cypress/integration/03 - v3-compatibility.ts index 82a9a9da..cd821f18 100644 --- a/cypress/integration/03 - v3-compatibility.ts +++ b/cypress/integration/03 - v3-compatibility.ts @@ -36,7 +36,7 @@ describe("v3 compatibility", () => { cy.doWithin(["pl-app", "pl-items-list"], () => cy.get("pl-icon[icon='add']").click()); // Click create - cy.doWithin(["pl-app", "pl-create-item-dialog"], () => cy.get(".footer button.primary").click(), 200); + cy.doWithin(["pl-app", "pl-create-item-dialog"], () => cy.get(".footer button.primary").click(), 500); cy.url().should("match", /\/items\/[0-9a-f]{8}-[0-9a-f]{4}-[0-5][0-9a-f]{3}-[089ab][0-9a-f]{3}-[0-9a-f]{12}/); @@ -64,7 +64,7 @@ describe("v3 compatibility", () => { // Close dialog cy.get("pl-icon[icon='close']").click(); }, - 1200 + 1500 ); cy.url().should("include", "/items"); diff --git a/package.json b/package.json index 1336e74c..97895f45 100644 --- a/package.json +++ b/package.json @@ -35,6 +35,7 @@ "server:start-dry": "lerna run start-dry --stream --scope @padloc/server", "electron:start": "lerna run start --scope @padloc/electron", "electron:build": "lerna run build --scope @padloc/electron", + "electron:build:flatpak": "lerna run build:flatpak", "web-extension:build": "lerna run build --scope @padloc/extension", "cordova:start:android": "lerna run start:android", "cordova:start:ios": "lerna run start:ios", @@ -55,7 +56,7 @@ "test:e2e": "concurrently --prefix=name --prefix-length=30 --kill-others --success=first -n app,v3-app,maildev,cypress \"PL_DATA_BACKEND=memory PL_DISABLE_SW=true PL_EMAIL_BACKEND=smtp PL_EMAIL_SMTP_HOST=localhost PL_EMAIL_SMTP_PORT=1025 PL_EMAIL_SMTP_IGNORE_TLS=true npm start\" \"npm run start:v3\" \"npx maildev\" \"./node_modules/.bin/wait-on tcp:localhost:8080 && CYPRESS_CRASH_REPORTS=0 cypress run\"", "test:e2e:dev": "concurrently --prefix=name --prefix-length=30 --kill-others --success=first -n app,v3-app,cypress \"PL_DATA_BACKEND=memory PL_DISABLE_SW=true PL_EMAIL_BACKEND=smtp PL_EMAIL_SMTP_HOST=localhost PL_EMAIL_SMTP_PORT=1025 PL_EMAIL_SMTP_IGNORE_TLS=true npm run dev\" \"npm run start:v3\" \"npx maildev\" \"./node_modules/.bin/wait-on tcp:localhost:8080 && CYPRESS_CRASH_REPORTS=0 cypress open\"", "locale:extract": "lerna run extract --scope '@padloc/locale'", - "add": "lerna add $1 --scope=@padloc/$scope", + "add": "lerna add $1 --exact --scope=@padloc/$scope", "remove": "rm packages/$scope/package-lock.json && lerna exec \"npm uninstall $1\" --scope=@padloc/$scope", "prettier": "prettier --write .", "prettier:check": "prettier --check .", diff --git a/packages/electron/package.json b/packages/electron/package.json index 7b0219ad..0725c3ea 100644 --- a/packages/electron/package.json +++ b/packages/electron/package.json @@ -14,6 +14,7 @@ }, "scripts": { "build": "rm -rf app build dist && webpack && node ./prepare-build.js && electron-builder --config build/build.json", + "build:flatpak": "electron-builder --config build/build-flatpak.json", "start": "webpack && electron app/main.js" }, "author": "MaKleSoft UG", diff --git a/packages/electron/prepare-build.js b/packages/electron/prepare-build.js index f43d67ab..6e3f70f3 100644 --- a/packages/electron/prepare-build.js +++ b/packages/electron/prepare-build.js @@ -17,6 +17,7 @@ async function main() { const { width } = await baseIcon.metadata(); const padding = Math.floor(width / 20); await baseIcon + .resize(512 - padding * 2, 512 - padding * 2, { fit: "inside" }) // Some targets don't deal well with images > 512x512 .extend({ top: padding, right: padding, @@ -49,12 +50,28 @@ async function main() { schemes: [scheme], }, linux: { + target: ["AppImage", "snap", "deb", "dir"], category: "Utility", }, + snap: { + confinement: "classic", + }, afterSign: "scripts/notarize.js", }; fs.writeFileSync(join(buildDir, "build.json"), JSON.stringify(buildConfig, null, 4), "utf-8"); + + // Write flatpak-specific config, which has a few more restrictions + const flatpakConfig = { + ...buildConfig, + appId: appId.split(".").length > 2 ? appId : `${appId}.app`, // appId needs to have 2 periods and can't finish on one + linux: { + ...buildConfig.linux, + target: "flatpak", + }, + }; + + fs.writeFileSync(join(buildDir, "build-flatpak.json"), JSON.stringify(flatpakConfig, null, 4), "utf-8"); } main();