Add snap and flatpak options to electron publishing and release

Also adds `deb` and tweaks the v3 compatibility test a bit more since it has failed a couple of times in the last week.

Fixes #201
This commit is contained in:
Bruno Bernardino 2022-07-04 12:22:12 +01:00
parent a312b9b177
commit b1c6ea39ad
No known key found for this signature in database
GPG Key ID: D1B0A69ADD114ECE
9 changed files with 103 additions and 4 deletions

View File

@ -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:

View File

@ -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: |

1
.gitignore vendored
View File

@ -28,3 +28,4 @@ packages/extension/dist
packages/tauri/dist
packages/tauri/src-tauri/icons
packages/tauri/tauri-update.json
.flatpak-builder

View File

@ -12,3 +12,4 @@ packages/tauri/tauri-update.json
packages/pwa/dist/**/*
package-lock.json
cypress/fixtures/**/*
.flatpak-builder/**/*

View File

@ -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 <martin@maklesoft.com>",

View File

@ -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");

View File

@ -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 .",

View File

@ -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",

View File

@ -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();