diff --git a/.github/workflows/dev-release.yml b/.github/workflows/dev-release.yml new file mode 100644 index 0000000..b226f0a --- /dev/null +++ b/.github/workflows/dev-release.yml @@ -0,0 +1,82 @@ +name: "publish" + +on: + push: + branches: + - dev-release + +# This workflow will trigger on each push to the `release` branch to create or update a GitHub release, build your app, and upload the artifacts to the release. + +jobs: + publish-tauri: + permissions: + contents: write + actions: read + strategy: + fail-fast: false + matrix: + include: + - platform: "macos-latest" # for Arm based macs (M1 and above). + args: "--target aarch64-apple-darwin" + - platform: "macos-latest" # for Intel based macs. + args: "--target x86_64-apple-darwin" + - platform: "ubuntu-20.04" # for Tauri v1 you could replace this with ubuntu-20.04. + args: "" + - platform: "windows-latest" + args: "" + + runs-on: ${{ matrix.platform }} + steps: + - uses: actions/checkout@v4 + + - name: setup node + uses: actions/setup-node@v4 + with: + node-version: lts/* + + - name: install Rust stable + uses: dtolnay/rust-toolchain@stable + with: + # Those targets are only used on macos runners so it's in an `if` to slightly speed up windows and linux builds. + targets: ${{ matrix.platform == 'macos-latest' && 'aarch64-apple-darwin,x86_64-apple-darwin' || '' }} + + - name: install dependencies (ubuntu only) + if: matrix.platform == 'ubuntu-22.04' # This must match the platform value defined above. + run: | + sudo apt-get update + sudo apt-get install -y libwebkit2gtk-4.0-dev libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf + # webkitgtk 4.0 is for Tauri v1 - webkitgtk 4.1 is for Tauri v2. + # You can remove the one that doesn't apply to your app to speed up the workflow a bit. + + - name: import windows certificate + if: matrix.platform == 'windows-latest' + env: + WINDOWS_CERTIFICATE: ${{ secrets.WINDOWS_CERTIFICATE }} + WINDOWS_CERTIFICATE_PASSWORD: ${{ secrets.WINDOWS_CERTIFICATE_PASSWORD }} + run: | + New-Item -ItemType directory -Path certificate + Set-Content -Path certificate/tempCert.txt -Value $env:WINDOWS_CERTIFICATE + certutil -decode certificate/tempCert.txt certificate/certificate.pfx + Remove-Item -path certificate -include tempCert.txt + Import-PfxCertificate -FilePath certificate/certificate.pfx -CertStoreLocation Cert:\CurrentUser\My -Password (ConvertTo-SecureString -String $env:WINDOWS_CERTIFICATE_PASSWORD -Force -AsPlainText) + + - name: install frontend dependencies + run: npm install + + - uses: tauri-apps/tauri-action@v0 + id: tauri-build + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + APPLE_CERTIFICATE: ${{ secrets.APPLE_CERTIFICATE }} + APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }} + APPLE_SIGNING_IDENTITY: ${{ secrets.APPLE_SIGNING_IDENTITY }} + APPLE_ID: ${{ secrets.APPLE_ID }} + APPLE_PASSWORD: ${{ secrets.APPLE_PASSWORD }} + APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }} + with: + tagName: keeper-desktop-v__VERSION__-dev # the action automatically replaces \_\_VERSION\_\_ with the app version. + releaseName: "Keeper Desktop v__VERSION__ (dev)" + releaseBody: "This is a development version of Keeper Desktop. It is not meant for production use." + releaseDraft: true + prerelease: false + args: ${{ matrix.args }} diff --git a/.github/workflows/tauri-build.yml b/.github/workflows/release.yml similarity index 94% rename from .github/workflows/tauri-build.yml rename to .github/workflows/release.yml index ad750da..5d53352 100644 --- a/.github/workflows/tauri-build.yml +++ b/.github/workflows/release.yml @@ -20,7 +20,7 @@ jobs: args: "--target aarch64-apple-darwin" - platform: "macos-latest" # for Intel based macs. args: "--target x86_64-apple-darwin" - - platform: "ubuntu-22.04" # for Tauri v1 you could replace this with ubuntu-20.04. + - platform: "ubuntu-20.04" # for Tauri v1 you could replace this with ubuntu-20.04. args: "" - platform: "windows-latest" args: "" @@ -61,7 +61,7 @@ jobs: Import-PfxCertificate -FilePath certificate/certificate.pfx -CertStoreLocation Cert:\CurrentUser\My -Password (ConvertTo-SecureString -String $env:WINDOWS_CERTIFICATE_PASSWORD -Force -AsPlainText) - name: install frontend dependencies - run: yarn install # change this to npm, pnpm or bun depending on which one you use. + run: npm install - uses: tauri-apps/tauri-action@v0 id: tauri-build @@ -79,4 +79,4 @@ jobs: releaseBody: "See the assets to download this version and install." releaseDraft: true prerelease: false - args: ${{ matrix.args }} + args: ${{ matrix.args }} --config src-tauri/tauri.release.conf.json diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index a34686f..962b473 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -26,5 +26,6 @@ env_logger = "0.10" bitcoin = { version = "0.32.2", features = ["serde", "base64"] } [features] +release = [] # This feature is used for production builds or when a dev server is not specified, DO NOT REMOVE!! custom-protocol = ["tauri/custom-protocol"] diff --git a/src-tauri/src/channel.rs b/src-tauri/src/channel.rs index 1efdfee..baba238 100644 --- a/src-tauri/src/channel.rs +++ b/src-tauri/src/channel.rs @@ -12,8 +12,12 @@ use tauri::Manager; use thiserror::Error; use tokio::time::timeout; +#[cfg(not(feature = "release"))] static URL: &str = "https://keeper-channel-dev-8d01fa5233d0.herokuapp.com/"; +#[cfg(feature = "release")] +static URL: &str = "https://keeper-channel.herokuapp.com/"; + #[derive(Error, Debug)] pub enum ChannelError { #[error("No client available")] diff --git a/src-tauri/tauri.release.conf.json b/src-tauri/tauri.release.conf.json new file mode 100644 index 0000000..23ea2c0 --- /dev/null +++ b/src-tauri/tauri.release.conf.json @@ -0,0 +1,5 @@ +{ + "build": { + "features": ["release"] + } +}