CI: Full Release (#376)

* CI: Full Release

This implements a full release action that takes care of creating a tag, release, then building and uploading builds for all targets.
This commit is contained in:
Bruno Bernardino 2022-01-17 17:32:21 +00:00 committed by GitHub
parent a3759db0f0
commit 1589b05baa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
22 changed files with 15078 additions and 14812 deletions

View File

@ -40,7 +40,7 @@ jobs:
run: npm run web-extension:build
- name: Sign for Firefox
if: github.event.inputs.environment == 'Beta' || github.event.inputs.environment == 'Production'
run: cd packages/extension/dist && web-ext sign --id="{9e5ca7e8-2073-49d1-a93f-ac2f2088ff14}" --channel=unlisted --api-key=${{ secrets.PL_WEB_EXTENSION_FIREFOX_API_KEY }} --api-secret=${{ secrets.PL_WEB_EXTENSION_FIREFOX_API_SECRET }}
run: cd packages/extension/dist && web-ext sign --id="${{ secrets.PL_WEB_EXTENSION_FIREFOX_ID }}" --channel=unlisted --api-key=${{ secrets.PL_WEB_EXTENSION_FIREFOX_API_KEY }} --api-secret=${{ secrets.PL_WEB_EXTENSION_FIREFOX_API_SECRET }}
- name: Archive Signed Web Extension (Firefox)
if: github.event.inputs.environment == 'Beta' || github.event.inputs.environment == 'Production'
uses: actions/upload-artifact@v2
@ -63,7 +63,8 @@ jobs:
extensionDir: packages/extension/dist
zipFilePath: packages/extension/padloc.zip
zipIgnore: web-ext-artifacts/**|*.xpi
- uses: cardinalby/webext-buildtools-chrome-crx-action@v2
- name: Sign for Chrome
uses: cardinalby/webext-buildtools-chrome-crx-action@v2
with:
zipFilePath: packages/extension/padloc.zip
crxFilePath: packages/extension/padloc-signed.crx

325
.github/workflows/publish-release.yml vendored Normal file
View File

@ -0,0 +1,325 @@
name: Publish Release
on:
workflow_dispatch:
inputs:
environment:
type: environment
default: "Beta"
vendor_version:
type: string
description: "Vendor Version (semver) for the release -- what will be visible."
default: "0.0.1"
required: true
build:
type: string
description: "Build number (int, 3 max digits) for the release."
default: "0"
required: true
jobs:
create_release_tag:
name: "Create release tag"
environment: ${{ github.event.inputs.environment || 'Beta' }}
env:
PL_VENDOR_VERSION: ${{ github.event.inputs.vendor_version || '0.0.1' }}
PL_VENDOR_BASE_URL: "https://github.com/${{ github.repository }}"
runs-on: ubuntu-latest
outputs:
release_id: ${{ steps.create_release.outputs.id }}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version-file: ".nvmrc"
- name: Install dependencies
run: |
npm i -g npm@8.2.0
npm ci
- name: Build tauri-update.json
run: cd packages/tauri && node generate-tauri-update-file.js
- uses: softprops/action-gh-release@v1
id: create_release
name: Create release and add tauri-update.json
with:
tag_name: "v${{ env.PL_VENDOR_VERSION }}"
name: "v${{ env.PL_VENDOR_VERSION }}"
body: "v${{ env.PL_VENDOR_VERSION }}"
prerelease: true
draft: false
files: packages/tauri/tauri-update.json
fail_on_unmatched_files: true
release_web_extension:
name: "Release web extension"
environment: ${{ github.event.inputs.environment || 'Beta' }}
needs: create_release_tag
env:
RELEASE_BUILD: ${{ github.event.inputs.build || '0' }}
PL_VENDOR_VERSION: ${{ github.event.inputs.vendor_version || '0.0.1' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version-file: ".nvmrc"
- name: Install dependencies
run: |
npm i -g npm@8.2.0 web-ext@6.6.0
npm ci
- name: Build
env:
PL_SERVER_URL: ${{ secrets.PL_SERVER_URL }}
PL_BUILD_ENV: ${{ secrets.PL_BUILD_ENV }}
run: npm run web-extension:build
- name: Sign for Firefox
run: cd packages/extension/dist && web-ext sign --id="${{ secrets.PL_WEB_EXTENSION_FIREFOX_ID }}" --channel=unlisted --api-key=${{ secrets.PL_WEB_EXTENSION_FIREFOX_API_KEY }} --api-secret=${{ secrets.PL_WEB_EXTENSION_FIREFOX_API_SECRET }}
- name: Upload Signed Web Extension (Firefox)
uses: svenstaro/upload-release-action@2.2.1
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
tag: "v${{ env.PL_VENDOR_VERSION }}"
file: packages/extension/dist/web-ext-artifacts/padloc-${{ env.PL_VENDOR_VERSION }}.${{ env.RELEASE_BUILD }}-an+fx.xpi
asset_name: padloc-web-extension-${{ env.PL_VENDOR_VERSION }}.${{ env.RELEASE_BUILD }}.xpi
prerelease: true
- name: Pack for Chrome Extension
uses: cardinalby/webext-buildtools-pack-extension-dir-action@v1
with:
extensionDir: packages/extension/dist
zipFilePath: packages/extension/padloc.zip
zipIgnore: web-ext-artifacts/**|*.xpi
- name: Upload Unsigned Web Extension (Chrome)
uses: svenstaro/upload-release-action@2.2.1
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
tag: "v${{ env.PL_VENDOR_VERSION }}"
file: packages/extension/padloc.zip
asset_name: padloc-web-extension-${{ env.PL_VENDOR_VERSION }}.${{ env.RELEASE_BUILD }}-unsigned.zip
prerelease: true
- name: Sign for Chrome
uses: cardinalby/webext-buildtools-chrome-crx-action@v2
with:
zipFilePath: packages/extension/padloc.zip
crxFilePath: packages/extension/padloc-signed.crx
privateKey: ${{ secrets.PL_WEB_EXTENSION_CHROME_CRX_PRIVATE_KEY }}
- name: Upload Signed Web Extension (Chrome)
uses: svenstaro/upload-release-action@2.2.1
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
tag: "v${{ env.PL_VENDOR_VERSION }}"
file: packages/extension/padloc-signed.crx
asset_name: padloc-web-extension-${{ env.PL_VENDOR_VERSION }}.${{ env.RELEASE_BUILD }}.crx
prerelease: true
release_tauri:
name: "Release Tauri apps"
environment: ${{ github.event.inputs.environment || 'Beta' }}
needs: create_release_tag
env:
RELEASE_ID: ${{ needs.create_release_tag.outputs.release_id }}
PL_VENDOR_VERSION: ${{ github.event.inputs.vendor_version || '0.0.1' }}
strategy:
fail-fast: false
matrix:
platform: [macos-latest, ubuntu-latest, windows-latest]
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version-file: ".nvmrc"
- name: Install Rust stable
uses: actions-rs/toolchain@v1
with:
toolchain: stable
- name: Install tauri bundler
run: cargo install tauri-bundler --force
- name: Install webkit2gtk (ubuntu only)
if: matrix.platform == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y webkit2gtk-4.0
- name: Install dependencies
run: |
npm i -g npm@8.2.0
npm ci
- uses: tauri-apps/tauri-action@v0.2.0
env:
PL_SERVER_URL: ${{ secrets.PL_SERVER_URL }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }}
ENABLE_CODE_SIGNING: true
APPLE_CERTIFICATE: ${{ secrets.PL_MACOS_SIGNING_CERT_BASE64 }}
APPLE_CERTIFICATE_PASSWORD: ${{ secrets.PL_MACOS_SIGNING_CERT_PASSWORD }}
APPLE_SIGNING_IDENTITY: ${{ secrets.PL_MACOS_SIGNING_IDENTITY }}
APPLE_ID: ${{ secrets.PL_MACOS_NOTARIZE_APPLE_ID }}
APPLE_PASSWORD: ${{ secrets.PL_MACOS_NOTARIZE_PASSWORD }}
with:
releaseId: ${{ env.RELEASE_ID }}
projectPath: packages/tauri
release_electron:
name: "Release Electron apps"
environment: ${{ github.event.inputs.environment || 'Beta' }}
needs: create_release_tag
env:
RELEASE_ID: ${{ needs.create_release_tag.outputs.release_id }}
PL_VENDOR_VERSION: ${{ github.event.inputs.vendor_version || '0.0.1' }}
strategy:
fail-fast: false
matrix:
platform: [macos-latest, ubuntu-latest, windows-latest]
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version-file: ".nvmrc"
- name: Install dependencies
run: |
npm i -g npm@8.2.0
npm ci
- name: Build
run: |
npm run electron:build
env:
PL_PWA_URL: ${{ secrets.PL_PWA_URL }}
CSC_LINK: ${{ secrets.PL_MACOS_SIGNING_CERT_BASE64 }}
CSC_KEY_PASSWORD: ${{ secrets.PL_MACOS_SIGNING_CERT_PASSWORD }}
PL_MACOS_NOTARIZE_APPLE_ID: ${{ secrets.PL_MACOS_NOTARIZE_APPLE_ID }}
PL_MACOS_NOTARIZE_PASSWORD: ${{ secrets.PL_MACOS_NOTARIZE_PASSWORD }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
EP_PRE_RELEASE: true
release_cordova:
name: "Release Cordova apps"
environment: ${{ github.event.inputs.environment || 'Beta' }}
needs: create_release_tag
env:
RELEASE_BUILD: ${{ github.event.inputs.build || '0' }}
RELEASE_ID: ${{ needs.create_release_tag.outputs.release_id }}
PL_VENDOR_VERSION: ${{ github.event.inputs.vendor_version || '0.0.1' }}
PL_SERVER_URL: ${{ secrets.PL_SERVER_URL }}
strategy:
fail-fast: false
matrix:
platform: [macos-latest, ubuntu-latest]
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v1
if: matrix.platform == 'ubuntu-latest'
with:
java-version: 1.8
- uses: sdkman/sdkman-action@master
if: matrix.platform == 'ubuntu-latest'
with:
candidate: gradle
version: 7.2
- uses: android-actions/setup-android@v2
if: matrix.platform == 'ubuntu-latest'
- uses: actions/setup-node@v2
with:
node-version-file: ".nvmrc"
- name: Install dependencies
run: |
npm i -g npm@8.2.0
npm ci
- name: Create android-upload-key.keystore
if: matrix.platform == 'ubuntu-latest'
run: |
cd packages/cordova
echo '${{ secrets.PL_ANDROID_UPLOAD_KEY_BASE64}}' > android-upload-key.keystore.txt
base64 -d android-upload-key.keystore.txt > android-upload-key.keystore
rm -f android-upload-key.keystore.txt
- name: Build Android
if: matrix.platform == 'ubuntu-latest'
run: |
cd packages/cordova
npm run prepare-build
./node_modules/.bin/cordova build android --release -- --packageType=apk --keystore=./android-upload-key.keystore --storePassword='${{ secrets.PL_ANDROID_STORE_PASSWORD }}' --alias=${{ secrets.PL_ANDROID_KEYSTORE_ALIAS }} --password='${{ secrets.PL_ANDROID_STORE_PASSWORD }}'
- name: Install the Apple certificate and provisioning profile
if: matrix.platform == 'macos-latest'
env:
PL_IOS_DISTRIBUTION_CERT_BASE64: ${{ secrets.PL_IOS_DISTRIBUTION_CERT_BASE64 }}
PL_IOS_DEVELOPMENT_CERT_BASE64: ${{ secrets.PL_IOS_DEVELOPMENT_CERT_BASE64 }}
PL_IOS_DISTRIBUTION_CERT_PASSWORD: ${{ secrets.PL_IOS_DISTRIBUTION_CERT_PASSWORD }}
PL_IOS_PROVISION_PROFILE_BASE64: ${{ secrets.PL_IOS_PROVISION_PROFILE_BASE64 }}
PL_IOS_DEV_PROVISION_PROFILE_BASE64: ${{ secrets.PL_IOS_DEV_PROVISION_PROFILE_BASE64 }}
PL_IOS_KEYCHAIN_PASSWORD: "new-password-does-not-matter"
run: |
# create variables
DIST_CERT_PATH=$RUNNER_TEMP/distribution_certificate.p12
DEV_CERT_PATH=$RUNNER_TEMP/development_certificate.p12
DIST_PP_PATH=$RUNNER_TEMP/dist_pp.mobileprovision
DEV_PP_PATH=$RUNNER_TEMP/dev_pp.mobileprovision
KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db
# import certificate and provisioning profile from secrets
echo -n "$PL_IOS_DISTRIBUTION_CERT_BASE64" | base64 --decode --output $DIST_CERT_PATH
echo -n "$PL_IOS_DEVELOPMENT_CERT_BASE64" | base64 --decode --output $DEV_CERT_PATH
echo -n "$PL_IOS_PROVISION_PROFILE_BASE64" | base64 --decode --output $DIST_PP_PATH
echo -n "$PL_IOS_DEV_PROVISION_PROFILE_BASE64" | base64 --decode --output $DEV_PP_PATH
# create temporary keychain
security create-keychain -p "$PL_IOS_KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
security set-keychain-settings -lut 21600 $KEYCHAIN_PATH
security unlock-keychain -p "$PL_IOS_KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
# import certificate to keychain
security import $DIST_CERT_PATH -P "$PL_IOS_DISTRIBUTION_CERT_PASSWORD" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH
security import $DEV_CERT_PATH -P "$PL_IOS_DISTRIBUTION_CERT_PASSWORD" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH
security list-keychain -d user -s $KEYCHAIN_PATH
security set-key-partition-list -S apple-tool:,apple: -s -k "$PL_IOS_KEYCHAIN_PASSWORD" $KEYCHAIN_PATH
# apply provisioning profile
mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles
cp $DIST_PP_PATH ~/Library/MobileDevice/Provisioning\ Profiles
cp $DEV_PP_PATH ~/Library/MobileDevice/Provisioning\ Profiles
- name: Setup Xcode
uses: maxim-lobanov/setup-xcode@v1
if: matrix.platform == 'macos-latest'
with:
xcode-version: "13.2.1"
- name: Build iOS
if: matrix.platform == 'macos-latest'
run: |
cd packages/cordova
npm run prepare-build
npm run patch-ios
./node_modules/.bin/cordova build ios --release --device --packageType=app-store --codeSignIdentity="${{ secrets.PL_IOS_CODE_SIGN_IDENTITY }}" --developmentTeam="${{ secrets.PL_IOS_DEVELOPMENT_TEAM }}"
- name: Upload Signed APK
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/cordova/platforms/android/app/build/outputs/apk/release/app-release.apk
asset_name: padloc-${{ env.PL_VENDOR_VERSION }}.apk
prerelease: true
- name: Upload Signed IPA
if: matrix.platform == 'macos-latest'
uses: svenstaro/upload-release-action@2.2.1
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
tag: "v${{ env.PL_VENDOR_VERSION }}"
file: packages/cordova/platforms/ios/build/device/Padloc.ipa
asset_name: padloc-${{ env.PL_VENDOR_VERSION }}.ipa
prerelease: true
- name: Delete android-upload-key.keystore
if: matrix.platform == 'ubuntu-latest' && always()
run: rm -f ./packages/cordova/android-upload-key.keystore
- name: Clean up keychain and provisioning profile
if: matrix.platform == 'macos-latest' && always()
run: |
security delete-keychain $RUNNER_TEMP/app-signing.keychain-db
rm -f ~/Library/MobileDevice/Provisioning\ Profiles/build_pp.mobileprovision

View File

@ -1,89 +0,0 @@
name: Release Tauri
on:
workflow_dispatch:
inputs:
environment:
type: environment
default: "Beta"
version:
type: string
description: "Version (semver) for the release."
default: "0.0.1"
required: true
jobs:
create_release_tag:
name: "Create release tag"
environment: ${{ github.event.inputs.environment || 'Beta' }}
env:
RELEASE_VERSION: ${{ github.event.inputs.version || '0.0.1' }}
runs-on: ubuntu-latest
outputs:
release_id: ${{ steps.create_release.outputs.id }}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version-file: ".nvmrc"
- name: Build tauri-update.json
run: cd packages/tauri && node generate-tauri-update-file.js
- uses: rickstaa/action-create-tag@v1
with:
tag: "tauri-v${{ env.RELEASE_VERSION }}"
message: "v${{ env.RELEASE_VERSION }}"
- uses: softprops/action-gh-release@v1
id: create_release
name: Create release and add tauri-update.json
with:
tag_name: "tauri-v${{ env.RELEASE_VERSION }}"
name: "Padloc (Tauri Edition) v${{ env.RELEASE_VERSION }}"
body: "WARNING: The builds in this release are experimental. Use at your own risk!"
prerelease: true
draft: true
files: packages/tauri/tauri-update.json
fail_on_unmatched_files: true
release:
environment: ${{ github.event.inputs.environment || 'Beta' }}
needs: create_release_tag
env:
RELEASE_VERSION: ${{ github.event.inputs.version || '0.0.1' }}
RELEASE_ID: ${{ needs.create_release_tag.outputs.release_id }}
strategy:
fail-fast: false
matrix:
platform: [macos-latest, ubuntu-latest, windows-latest]
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version-file: ".nvmrc"
- name: Install Rust stable
uses: actions-rs/toolchain@v1
with:
toolchain: stable
- name: Install tauri bundler
run: cargo install tauri-bundler --force
- name: Install webkit2gtk (ubuntu only)
if: matrix.platform == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y webkit2gtk-4.0
- name: Install dependencies
run: |
npm i -g npm@8.2.0
npm ci
- uses: tauri-apps/tauri-action@v0.2.0
env:
PL_SERVER_URL: ${{ secrets.PL_SERVER_URL }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }}
with:
releaseId: ${{ env.RELEASE_ID }}
projectPath: packages/tauri

View File

@ -87,3 +87,9 @@ Use `npm run prettier` to make "prettify" all files.
## Security
For a security design overview, check out the [security whitepaper](security.md).
## Deployment/Publishing
Locally, run `npm run update-version 0.0.1` replacing `0.0.1` with the version you'd like to release, and commit + push/merge.
In GitHub Actions, run the [`Publish Release`](https://github.com/padloc/padloc/actions?workflow=Publish+Release) action to generate the release, build all targets, and attach them to the release.

View File

@ -2,8 +2,6 @@
"name": "Padloc",
"background_color": "#ffffff",
"description": "A modern password manager for indviduals and teams",
"version": "4.0.0",
"build": "4.0.0.0",
"appId": "app.padloc",
"scheme": "padloc",
"author": "Martin Kleinschrodt <martin@maklesoft.com>",

View File

@ -49,6 +49,8 @@
"add": "lerna add $1 --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 ."
"prettier:check": "prettier --check .",
"update-version": "lerna version $1 --yes",
"publish": "lerna publish"
}
}

File diff suppressed because it is too large Load Diff

View File

@ -44,9 +44,11 @@
"cordova-clipboard": "1.3.0",
"cordova-ios": "6.2.0",
"cordova-plugin-add-swift-support": "2.0.2",
"cordova-plugin-androidx-adapter": "1.1.3",
"cordova-plugin-app-version": "0.1.12",
"cordova-plugin-backbutton": "0.3.0",
"cordova-plugin-device": "2.0.3",
"cordova-plugin-fingerprint-aio": "4.0.2",
"cordova-plugin-inappbrowser": "5.0.0",
"cordova-plugin-ionic-webview": "5.0.0",
"cordova-plugin-privacyscreen": "0.4.0",
@ -54,8 +56,6 @@
"cordova-plugin-splashscreen": "6.0.0",
"cordova-plugin-statusbar": "2.4.3",
"cordova-plugin-x-socialsharing": "6.0.3",
"cordova-plugin-androidx-adapter": "1.1.3",
"cordova-plugin-fingerprint-aio": "4.0.2",
"es6-promise-plugin": "4.2.2",
"ionic-plugin-keyboard": "2.2.1",
"typescript": "4.4.3"
@ -65,15 +65,16 @@
"clean-webpack-plugin": "3.0.0",
"cordova": "10.0.0",
"css-loader": "5.2.6",
"dotenv": "10.0.0",
"file-loader": "6.2.0",
"html-webpack-plugin": "5.3.1",
"raw-loader": "4.0.2",
"sharp": "0.29.1",
"style-loader": "2.0.0",
"ts-loader": "9.2.2",
"ts-node": "10.0.0",
"webpack": "5.38.1",
"webpack-cli": "4.7.0",
"sharp": "0.29.1",
"raw-loader": "4.0.2",
"xml-js": "1.6.11"
},
"scripts": {
@ -85,6 +86,6 @@
"build:android": "npm run prepare-build && cordova build android",
"build:android:signed": "npm run prepare-build && cordova build android --release -- --packageType=apk --keystore=./android-upload-key.keystore --storePassword=$PL_ANDROID_STORE_PASSWORD --alias=$PL_ANDROID_KEYSTORE_ALIAS --password=$PL_ANDROID_STORE_PASSWORD",
"build:ios": "npm run prepare-build && npm run patch-ios && cordova build ios",
"build:ios:signed": "npm run prepare-build && npm run patch-ios && cordova build ios --release -- --packageType=app-store --codeSignIdentity=$PL_IOS_CODE_SIGN_IDENTITY --developmentTeam=$PL_IOS_DEVELOPMENT_TEAM"
"build:ios:signed": "npm run prepare-build && npm run patch-ios && cordova build ios --release --device -- --packageType=app-store --codeSignIdentity=$PL_IOS_CODE_SIGN_IDENTITY --developmentTeam=$PL_IOS_DEVELOPMENT_TEAM"
}
}

View File

@ -2,20 +2,26 @@ const { resolve, join } = require("path");
const fs = require("fs");
const { xml2js, js2xml } = require("xml-js");
require("dotenv").config();
const rootDir = resolve(__dirname, "../..");
const assetsDir = resolve(rootDir, process.env.PL_ASSETS_DIR || "assets");
const configPath = resolve(__dirname, "config.xml");
const { name, version, appId, build } = require(join(assetsDir, "manifest.json"));
const { version } = require("./package.json");
const { name, appId } = require(join(assetsDir, "manifest.json"));
const vendorVersion = process.env.PL_VENDOR_VERSION || version;
const vendorBuild = `${vendorVersion}.${process.env.PL_BUILD_ENV === "Production" ? process.env.RELEASE_BUILD : "0"}`;
async function main() {
const configXML = fs.readFileSync(configPath, "utf-8");
const configObj = xml2js(configXML, { compact: true });
configObj.widget._attributes.id = appId;
configObj.widget._attributes.version = version;
configObj.widget._attributes["ios-CFBundleVersion"] = build;
configObj.widget._attributes["android-versionCode"] = build
configObj.widget._attributes.version = vendorVersion;
configObj.widget._attributes["ios-CFBundleVersion"] = vendorBuild;
configObj.widget._attributes["android-versionCode"] = vendorBuild
.split(".")
.map((part) => part.padStart(2, "0"))
.join("");

View File

@ -8,7 +8,7 @@ const sharp = require("sharp");
const rootDir = resolve(__dirname, "../..");
const assetsDir = resolve(rootDir, process.env.PL_ASSETS_DIR || "assets");
const { name, icon_background, background_color, version: vendorVersion } = require(join(assetsDir, "manifest.json"));
const { name, icon_background, background_color } = require(join(assetsDir, "manifest.json"));
module.exports = {
entry: resolve(__dirname, "src/index.ts"),
@ -58,7 +58,7 @@ module.exports = {
PL_BILLING_STRIPE_PUBLIC_KEY: null,
PL_SUPPORT_EMAIL: "support@padloc.app",
PL_VERSION: version,
PL_VENDOR_VERSION: vendorVersion || version,
PL_VENDOR_VERSION: version,
PL_DISABLE_SW: true,
PL_AUTH_DEFAULT_TYPE: null,
PL_APP_NAME: name,

View File

@ -32,12 +32,12 @@
"electron-notarize": "1.1.1",
"file-loader": "6.2.0",
"html-webpack-plugin": "5.3.2",
"raw-loader": "4.0.2",
"sharp": "0.29.1",
"style-loader": "2.0.0",
"ts-loader": "9.2.5",
"webpack": "5.52.1",
"webpack-cli": "4.8.0",
"typescript": "4.4.3",
"raw-loader": "4.0.2",
"sharp": "0.29.1"
"webpack": "5.52.1",
"webpack-cli": "4.8.0"
}
}

View File

@ -1,78 +1,12 @@
const { resolve, join } = require("path");
const { EnvironmentPlugin } = require("webpack");
// const HtmlWebpackPlugin = require("html-webpack-plugin");
// const serverUrl = process.env.PL_SERVER_URL || `http://0.0.0.0:${process.env.PL_SERVER_PORT || 3000}`;
const rootDir = resolve(__dirname, "../..");
const assetsDir = resolve(rootDir, process.env.PL_ASSETS_DIR || "assets");
const { name, description, version, author, scheme } = require(join(assetsDir, "manifest.json"));
const { version } = require(resolve(__dirname, "package.json"));
const { name, description, author, scheme } = require(join(assetsDir, "manifest.json"));
module.exports = [
// {
// target: "electron-renderer",
// entry: {
// app: resolve(__dirname, "src/index.ts"),
// },
// output: {
// path: resolve(__dirname, "app"),
// filename: "[name].js",
// chunkFilename: "[name].chunk.js",
// },
// mode: "development",
// devtool: "source-map",
// stats: "minimal",
// resolve: {
// extensions: [".ts", ".js", ".css", ".svg", ".png", ".jpg"],
// alias: {
// assets: resolve(__dirname, assetsDir),
// },
// },
// module: {
// rules: [
// {
// test: /\.ts$/,
// loader: "ts-loader",
// },
// {
// test: /\.css$/,
// use: ["style-loader", "css-loader"],
// },
// {
// test: /\.(woff|woff2|eot|ttf|otf|svg)$/,
// use: ["file-loader"],
// },
// ],
// },
// plugins: [
// new EnvironmentPlugin({
// PL_SERVER_URL: `http://localhost:${process.env.PL_SERVER_PORT || 3000}`,
// PL_BILLING_ENABLED: null,
// PL_BILLING_DISABLE_PAYMENT: null,
// PL_BILLING_STRIPE_PUBLIC_KEY: null,
// PL_SUPPORT_EMAIL: "support@padloc.app",
// PL_VERSION: version,
// PL_DISABLE_SW: true,
// PL_AUTH_DEFAULT_TYPE: null,
// }),
// new HtmlWebpackPlugin({
// title: "Padloc",
// template: resolve(__dirname, "src/index.html"),
// meta: {
// "Content-Security-Policy": {
// "http-equiv": "Content-Security-Policy",
// content: `default-src 'self' ${serverUrl} ${
// process.env.PL_BILLING_ENABLED ? "https://*.stripe.com" : ""
// } blob:; style-src 'self' 'unsafe-inline'; object-src 'self' blob:; frame-src 'self' blob: ${
// process.env.PL_BILLING_ENABLED ? "https://*.stripe.com" : ""
// }; img-src 'self' blob: data:`,
// },
// },
// }),
// new optimize.LimitChunkCountPlugin({
// maxChunks: 1,
// }),
// ],
// },
{
target: "electron-main",
entry: {
@ -102,10 +36,17 @@ module.exports = [
PL_PWA_URL: `http://localhost:${process.env.PL_PWA_PORT || 8080}`,
PL_APP_SCHEME: scheme,
PL_APP_NAME: name,
PL_VENDOR_VERSION: version,
}),
{
apply(compiler) {
const package = JSON.stringify({ name, description, version, author, main: "main.js" });
const package = JSON.stringify({
name,
description,
version: process.env.PL_VENDOR_VERSION || version,
author,
main: "main.js",
});
// emit is asynchronous hook, tapping into it using tapAsync, you can use tapPromise/tap(synchronous) as well
compiler.hooks.emit.tapPromise("InjectAppPackage", async (compilation, callback) => {
// Insert this list into the webpack build as a new file asset:

View File

@ -4,13 +4,13 @@ const HtmlWebpackPlugin = require("html-webpack-plugin");
const { CleanWebpackPlugin } = require("clean-webpack-plugin");
const manifest = require("./src/manifest.json");
const sharp = require("sharp");
const { version } = require("../../package.json");
const { version } = require("./package.json");
const serverUrl = process.env.PL_SERVER_URL || `http://0.0.0.0:${process.env.PL_SERVER_PORT || 3000}`;
const rootDir = resolve(__dirname, "../..");
const assetsDir = resolve(rootDir, process.env.PL_ASSETS_DIR || "assets");
const { name, version: vendorVersion, build } = require(join(assetsDir, "manifest.json"));
const { name } = require(join(assetsDir, "manifest.json"));
module.exports = {
entry: {
@ -65,7 +65,7 @@ module.exports = {
PL_BILLING_STRIPE_PUBLIC_KEY: null,
PL_SUPPORT_EMAIL: "support@padloc.app",
PL_VERSION: version,
PL_VENDOR_VERSION: vendorVersion || version,
PL_VENDOR_VERSION: version,
PL_DISABLE_SW: true,
}),
new CleanWebpackPlugin(),
@ -84,16 +84,11 @@ module.exports = {
{
apply(compiler) {
compiler.hooks.emit.tapPromise("Web Extension Manifest", async (compilation) => {
const devBuildVersion = parseInt(new Date().getTime().toString().slice(-3), 10).toString();
const jsonString = JSON.stringify(
{
...manifest,
version:
process.env.PL_BUILD_ENV === "Production"
? build
: `${vendorVersion}.${devBuildVersion}`,
version_name: vendorVersion,
version: `${process.env.PL_VENDOR_VERSION || version}.${process.env.RELEASE_BUILD || "0"}`,
version_name: process.env.PL_VENDOR_VERSION || version,
name,
description: `${name} Browser Extension`,
},

View File

@ -4,7 +4,6 @@ const { InjectManifest } = require("workbox-webpack-plugin");
const HtmlWebpackPlugin = require("html-webpack-plugin");
const { CleanWebpackPlugin } = require("clean-webpack-plugin");
const WebpackPwaManifest = require("webpack-pwa-manifest");
// const FaviconsWebpackPlugin = require("favicons-webpack-plugin");
const { version } = require("../../package.json");
const sharp = require("sharp");
@ -13,7 +12,7 @@ const serverUrl = process.env.PL_SERVER_URL || `http://0.0.0.0:${process.env.PL_
const rootDir = resolve(__dirname, "../..");
const assetsDir = resolve(rootDir, process.env.PL_ASSETS_DIR || "assets");
const { name, version: vendorVersion } = require(join(assetsDir, "manifest.json"));
const { name } = require(join(assetsDir, "manifest.json"));
module.exports = {
entry: resolve(__dirname, "src/index.ts"),
@ -61,7 +60,7 @@ module.exports = {
PL_BILLING_STRIPE_PUBLIC_KEY: null,
PL_SUPPORT_EMAIL: "support@padloc.app",
PL_VERSION: version,
PL_VENDOR_VERSION: vendorVersion || version,
PL_VENDOR_VERSION: version,
PL_DISABLE_SW: false,
PL_CLIENT_SUPPORTED_AUTH_TYPES: "email",
}),
@ -76,7 +75,6 @@ module.exports = {
},
},
}),
// new FaviconsWebpackPlugin(resolve(__dirname, "assets/icon-512.png")),
new WebpackPwaManifest({
name: name,
short_name: name,

View File

@ -1,6 +1,6 @@
{
"name": "@padloc/server",
"version": "3.1.3",
"version": "4.0.0",
"lockfileVersion": 2,
"requires": true,
"packages": {

View File

@ -1,6 +1,6 @@
{
"name": "@padloc/server",
"version": "3.1.3",
"version": "4.0.0",
"description": "Padloc server component",
"private": true,
"files": [
@ -18,10 +18,10 @@
"ts-node-dev": "1.1.6"
},
"dependencies": {
"@padloc/core": "4.0.0",
"@padloc/locale": "4.0.0",
"@aws-sdk/client-s3": "3.25.0",
"@aws-sdk/types": "3.25.0",
"@padloc/core": "4.0.0",
"@padloc/locale": "4.0.0",
"@simplewebauthn/server": "4.0.0",
"@types/fs-extra": "9.0.11",
"@types/mixpanel": "2.14.3",

View File

@ -0,0 +1,40 @@
const { resolve } = require("path");
const { writeFileSync, readFileSync } = require("fs");
const TOML = require("@iarna/toml");
require("dotenv").config();
const rootDir = resolve(__dirname, "../..");
const assetsDir = resolve(rootDir, process.env.PL_ASSETS_DIR || "assets");
const tauriConfigFilePath = resolve(__dirname, "src-tauri", "tauri.conf.json");
const cargoTomlFilePath = resolve(__dirname, "src-tauri", "Cargo.toml");
const packageFilePath = resolve(__dirname, "package.json");
const manifestFilePath = resolve(assetsDir, "manifest.json");
const tauriConfig = require(tauriConfigFilePath);
const { version } = require(packageFilePath);
const manifest = require(manifestFilePath);
const vendorVersion = process.env.PL_VENDOR_VERSION || version;
const vendorName = manifest.name;
const vendorNameLowercase = vendorName.toLowerCase();
const vendorBaseUrl = process.env.PL_VENDOR_BASE_URL || "https://github.com/padloc/padloc";
tauriConfig.package.version = vendorVersion;
tauriConfig.package.productName = vendorName;
tauriConfig.tauri.bundle.identifier = manifest.appId;
tauriConfig.tauri.windows[0].title = vendorName;
tauriConfig.tauri.updater.endpoints[0] = `${vendorBaseUrl}/releases/download/latest/tauri-update.json`;
writeFileSync(tauriConfigFilePath, JSON.stringify(tauriConfig, null, 4), "utf-8");
const cargoToml = TOML.parse(readFileSync(cargoTomlFilePath, "utf-8"));
cargoToml.package.name = vendorNameLowercase;
cargoToml.package.description = vendorName;
cargoToml.package.version = vendorVersion;
cargoToml.package.authors = [manifest.author];
cargoToml.package.repository = vendorBaseUrl;
writeFileSync(cargoTomlFilePath, TOML.stringify(cargoToml), "utf-8");

View File

@ -1,28 +1,40 @@
const { resolve } = require("path");
const { writeFileSync } = require("fs");
require("dotenv").config();
const rootDir = resolve(__dirname, "../..");
const assetsDir = resolve(rootDir, process.env.PL_ASSETS_DIR || "assets");
const tauriUpdateFilePath = resolve(__dirname, "tauri-update.json");
const packageFilePath = resolve(__dirname, "package.json");
const manifestFilePath = resolve(assetsDir, "manifest.json");
const { version } = require(packageFilePath);
const manifest = require(manifestFilePath);
const now = new Date().toISOString();
const baseUrl = `https://github.com/padloc/padloc/releases/download/v${version}`;
const vendorVersion = process.env.PL_VENDOR_VERSION || version;
const vendorName = manifest.name;
const vendorNameLowercase = vendorName.toLowerCase();
const vendorBaseUrl = process.env.PL_VENDOR_BASE_URL || "https://github.com/padloc/padloc";
const baseUrl = `${vendorBaseUrl}/releases/download/v${vendorVersion}`;
const tauriUpdate = {
name: `v${version}`,
name: `v${vendorVersion}`,
pub_date: now,
platforms: {
darwin: {
url: `${baseUrl}/Padloc.app.tar.gz`,
signature: `${baseUrl}/Padloc.app.tar.gz.sig`,
url: `${baseUrl}/${vendorName}.app.tar.gz`,
signature: `${baseUrl}/${vendorName}.app.tar.gz.sig`,
},
linux: {
url: `${baseUrl}/padloc_${version}_amd64.AppImage.tar.gz`,
signature: `${baseUrl}/padloc_${version}_amd64.AppImage.tar.gz.sig`,
url: `${baseUrl}/${vendorNameLowercase}_${vendorVersion}_amd64.AppImage.tar.gz`,
signature: `${baseUrl}/${vendorNameLowercase}_${vendorVersion}_amd64.AppImage.tar.gz.sig`,
},
win64: {
url: `${baseUrl}/Padloc_${version}_x64.msi.zip`,
signature: `${baseUrl}/Padloc_${version}_x64.msi.zip.sig`,
url: `${baseUrl}/${vendorName}_${vendorVersion}_x64.msi.zip`,
signature: `${baseUrl}/${vendorName}_${vendorVersion}_x64.msi.zip.sig`,
},
},
};

View File

@ -7,17 +7,18 @@
"": {
"name": "@padloc/tauri",
"version": "4.0.0",
"license": "ISC",
"license": "GPL-3.0",
"dependencies": {
"@tauri-apps/api": "1.0.0-beta.8"
},
"devDependencies": {
"@iarna/toml": "2.2.5",
"@tauri-apps/cli": "1.0.0-beta.10",
"clean-webpack-plugin": "3.0.0",
"css-loader": "5.2.6",
"dotenv": "10.0.0",
"file-loader": "6.2.0",
"html-webpack-plugin": "5.3.1",
"process": "0.11.10",
"raw-loader": "4.0.2",
"style-loader": "2.0.0",
"ts-loader": "9.2.2",
@ -41,6 +42,12 @@
"node": ">=10.0.0"
}
},
"node_modules/@iarna/toml": {
"version": "2.2.5",
"resolved": "https://registry.npmjs.org/@iarna/toml/-/toml-2.2.5.tgz",
"integrity": "sha512-trnsAYxU3xnS1gPHPyU961coFyLkh4gAD/0zQ5mymY4yOZ+CYvsPqUbOFSw0aDM4y0tV7tiFxL/1XfXPNC6IPg==",
"dev": true
},
"node_modules/@nodelib/fs.scandir": {
"version": "2.1.5",
"resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz",
@ -2943,6 +2950,15 @@
"node": ">=8"
}
},
"node_modules/dotenv": {
"version": "10.0.0",
"resolved": "https://registry.npmjs.org/dotenv/-/dotenv-10.0.0.tgz",
"integrity": "sha512-rlBi9d8jpv9Sf1klPjNfFAuWDjKLwTIJJ/VxtoTwIR6hnZxcEOQCZg2oIL3MWBYw5GpUDKOEnND7LXTbIpQ03Q==",
"dev": true,
"engines": {
"node": ">=10"
}
},
"node_modules/download": {
"version": "6.2.5",
"resolved": "https://registry.npmjs.org/download/-/download-6.2.5.tgz",
@ -6785,15 +6801,6 @@
"renderkid": "^2.0.4"
}
},
"node_modules/process": {
"version": "0.11.10",
"resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz",
"integrity": "sha1-czIwDoQBYb2j5podHZGn1LwW8YI=",
"dev": true,
"engines": {
"node": ">= 0.6.0"
}
},
"node_modules/process-nextick-args": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz",
@ -9581,6 +9588,12 @@
"integrity": "sha512-Fxt+AfXgjMoin2maPIYzFZnQjAXjAL0PHscM5pRTtatFqB+vZxAM9tLp2Optnuw3QOQC40jTNeGYFOMvyf7v9g==",
"dev": true
},
"@iarna/toml": {
"version": "2.2.5",
"resolved": "https://registry.npmjs.org/@iarna/toml/-/toml-2.2.5.tgz",
"integrity": "sha512-trnsAYxU3xnS1gPHPyU961coFyLkh4gAD/0zQ5mymY4yOZ+CYvsPqUbOFSw0aDM4y0tV7tiFxL/1XfXPNC6IPg==",
"dev": true
},
"@nodelib/fs.scandir": {
"version": "2.1.5",
"resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz",
@ -11915,6 +11928,12 @@
"is-obj": "^2.0.0"
}
},
"dotenv": {
"version": "10.0.0",
"resolved": "https://registry.npmjs.org/dotenv/-/dotenv-10.0.0.tgz",
"integrity": "sha512-rlBi9d8jpv9Sf1klPjNfFAuWDjKLwTIJJ/VxtoTwIR6hnZxcEOQCZg2oIL3MWBYw5GpUDKOEnND7LXTbIpQ03Q==",
"dev": true
},
"download": {
"version": "6.2.5",
"resolved": "https://registry.npmjs.org/download/-/download-6.2.5.tgz",
@ -14872,12 +14891,6 @@
"renderkid": "^2.0.4"
}
},
"process": {
"version": "0.11.10",
"resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz",
"integrity": "sha1-czIwDoQBYb2j5podHZGn1LwW8YI=",
"dev": true
},
"process-nextick-args": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz",

View File

@ -9,13 +9,17 @@
"build:production": "tauri build",
"dev": "tauri dev",
"update": "tauri deps update",
"setup-tauri": "cd src-tauri && cargo build"
"setup-tauri": "cd src-tauri && cargo build",
"update:config": "node build-tauri-conf.js"
},
"author": "Martin Kleinschrodt <martin@maklesoft.com>",
"license": "GPL-3.0",
"devDependencies": {
"@iarna/toml": "2.2.5",
"@tauri-apps/cli": "1.0.0-beta.10",
"clean-webpack-plugin": "3.0.0",
"css-loader": "5.2.6",
"dotenv": "10.0.0",
"file-loader": "6.2.0",
"html-webpack-plugin": "5.3.1",
"raw-loader": "4.0.2",
@ -25,8 +29,7 @@
"typescript": "4.4.3",
"webpack": "5.52.0",
"webpack-cli": "4.9.1",
"webpack-dev-server": "4.7.1",
"@tauri-apps/cli": "1.0.0-beta.10"
"webpack-dev-server": "4.7.1"
},
"dependencies": {
"@padloc/app": "4.0.0",

View File

@ -6,8 +6,8 @@
"build": {
"distDir": "../dist",
"devPath": "http://localhost:8080",
"beforeDevCommand": "webpack serve",
"beforeBuildCommand": "npm run tauri icon -i ../../assets/app-icon.png && webpack"
"beforeDevCommand": "npm run update:config && webpack serve",
"beforeBuildCommand": "npm run update:config && npm run tauri icon -i ../../assets/app-icon.png && webpack"
},
"tauri": {
"bundle": {
@ -58,7 +58,7 @@
},
"updater": {
"active": true,
"endpoints": ["https://github.com/padloc/padloc/releases/download/tauri-latest/tauri-update.json"],
"endpoints": ["https://github.com/padloc/padloc/releases/download/latest/tauri-update.json"],
"dialog": true,
"pubkey": "dW50cnVzdGVkIGNvbW1lbnQ6IG1pbmlzaWduIHB1YmxpYyBrZXk6IDM5NDMxQ0I3MTA3NDU3RjIKUldUeVYzUVF0eHhET1ZpNUZDYWY3Zlk1aUN1ZkpXcU5wS0pSTERSay91ODBpWlBIcTViNk11RHgK"
},

View File

@ -8,7 +8,7 @@ const out = process.env.PL_PWA_DIR || resolve(__dirname, "dist");
const serverUrl = process.env.PL_SERVER_URL || `http://0.0.0.0:${process.env.PL_SERVER_PORT || 3000}`;
const rootDir = resolve(__dirname, "../..");
const assetsDir = resolve(rootDir, process.env.PL_ASSETS_DIR || "assets");
const { name, version: vendorVersion } = require(join(assetsDir, "manifest.json"));
const { name } = require(join(assetsDir, "manifest.json"));
module.exports = {
entry: resolve(__dirname, "src/index.ts"),
@ -53,7 +53,7 @@ module.exports = {
PL_SERVER_URL: serverUrl,
PL_SUPPORT_EMAIL: "support@padloc.app",
PL_VERSION: version,
PL_VENDOR_VERSION: vendorVersion || version,
PL_VENDOR_VERSION: version,
PL_DISABLE_SW: true,
PL_CLIENT_SUPPORTED_AUTH_TYPES: "email",
}),