diff --git a/.github/workflows/build-macos.yaml b/.github/workflows/build-macos.yaml index 1ef16da5..8f698e19 100644 --- a/.github/workflows/build-macos.yaml +++ b/.github/workflows/build-macos.yaml @@ -38,18 +38,23 @@ jobs: - uses: actions/setup-node@v6 with: - node-version: 25 + node-version: 26 - uses: pnpm/action-setup@v6 with: cache: true - version: 10 + version: 11 # Change to '--frozen-lockfile' once this gets fixed: # https://github.com/pnpm/action-setup/issues/40 - name: Install Node dependencies run: pnpm install --no-frozen-lockfile + - name: Install Node dependencies for New UI + run: | + cd new-ui + pnpm install --no-frozen-lockfile + - name: Install Rust stable uses: dtolnay/rust-toolchain@stable with: @@ -63,6 +68,11 @@ jobs: - name: Unlock keychain run: security -v unlock-keychain -p "${{ secrets.KEYCHAIN_PASSWORD }}" login.keychain + - name: Build new UI + run: | + cd new-ui + pnpm build + - name: Build app uses: tauri-apps/tauri-action@v0 env: diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index b1b883b5..f7bb499b 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -30,11 +30,12 @@ jobs: - uses: actions/setup-node@v6 with: - node-version: 25 + node-version: 26 - uses: pnpm/action-setup@v6 with: - version: 10 + cache: true + version: 11 run_install: false - name: Get pnpm store directory @@ -42,22 +43,28 @@ jobs: run: | echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV - - name: Setup pnpm cache - uses: actions/cache@v5 - with: - path: ${{ env.STORE_PATH }} - key: ${{ runner.os }}-pnpm-lint-store-${{ hashFiles('**/pnpm-lock.yaml') }} - restore-keys: | - ${{ runner.os }}-pnpm-lint-store- - # Change to '--frozen-lockfile' once this gets fixed: # https://github.com/pnpm/action-setup/issues/40 - name: Install Node dependencies run: pnpm install --no-frozen-lockfile + - name: Install Node dependencies for new UI + run: | + cd new-ui + pnpm install --no-frozen-lockfile + - name: Run Biome and Prettier Lint run: pnpm lint - # TODO: Restore when it works again: https://github.com/pnpm/pnpm/issues/11265 - # - name: Audit - # run: pnpm audit --prod + - name: Audit + run: pnpm audit --prod + + - name: Run Biome and Prettier Lint for new UI + run: | + cd new-ui + pnpm lint + + - name: Audit new UI + run: | + cd new-ui + pnpm audit --prod diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index f7519b1f..c1ee0173 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -62,11 +62,12 @@ jobs: - name: Install pnpm uses: pnpm/action-setup@v6 with: - version: 10 + cache: true + version: 11 - uses: actions/setup-node@v6 with: - node-version: 25 + node-version: 26 - name: Get pnpm store directory run: | @@ -78,19 +79,17 @@ jobs: echo Version: $VERSION echo "VERSION=$VERSION" >> ${GITHUB_ENV} echo "DEFGUARD_CLIENT_BUILD_VERSION=${GITHUB_REF_NAME#v}" >> ${GITHUB_ENV} - - uses: actions/cache@v5 - name: Setup pnpm cache - with: - path: ${{ env.STORE_PATH }} - key: ${{ runner.os }}-pnpm-build-store-${{ hashFiles('**/pnpm-lock.yaml') }} - restore-keys: | - ${{ runner.os }}-pnpm-build-store- # Change to '--frozen-lockfile' once this gets fixed: # https://github.com/pnpm/action-setup/issues/40 - name: Install Node dependencies run: pnpm install --no-frozen-lockfile + - name: Install Node dependencies for new UI + run: | + cd new-ui + pnpm install --no-frozen-lockfile + - name: Install Rust stable uses: dtolnay/rust-toolchain@stable @@ -98,6 +97,11 @@ jobs: run: | apt-get install -y build-essential libgtk-3-dev libwebkit2gtk-4.1-dev libayatana-appindicator3-dev librsvg2-dev patchelf libssl-dev libxdo-dev unzip protobuf-compiler libprotobuf-dev rpm + - name: Build new UI + run: | + cd new-ui + pnpm build + - name: Build packages uses: tauri-apps/tauri-action@v0.5.23 env: @@ -166,11 +170,12 @@ jobs: echo "DEFGUARD_CLIENT_BUILD_VERSION=${GITHUB_REF_NAME#v}" >> ${GITHUB_ENV} - uses: actions/setup-node@v6 with: - node-version: 25 + node-version: 26 - uses: pnpm/action-setup@v6 with: - version: 10 + cache: true + version: 11 run_install: false - name: Get pnpm store directory @@ -178,19 +183,16 @@ jobs: run: | echo "STORE_PATH=$(pnpm store path --silent)" >> ${GITHUB_ENV} - - name: Setup pnpm cache - uses: actions/cache@v5 - with: - path: ${{ env.STORE_PATH }} - key: ${{ runner.os }}-pnpm-build-store-${{ hashFiles('**/pnpm-lock.yaml') }} - restore-keys: | - ${{ runner.os }}-pnpm-build-store- - # Change to '--frozen-lockfile' once this gets fixed: # https://github.com/pnpm/action-setup/issues/40 - name: Install Node dependencies run: pnpm install --no-frozen-lockfile + - name: Install Node dependencies for new UI + run: | + cd new-ui + pnpm install --no-frozen-lockfile + - name: Install Rust stable uses: dtolnay/rust-toolchain@stable @@ -199,6 +201,11 @@ jobs: sudo apt-get update sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.1-dev libayatana-appindicator3-dev librsvg2-dev patchelf libssl-dev libxdo-dev unzip protobuf-compiler libprotobuf-dev rpm + - name: Build new UI + run: | + cd new-ui + pnpm build + - name: Build packages uses: tauri-apps/tauri-action@v0.5.23 # .24 seems broken, TODO: update when fixed env: @@ -343,21 +350,14 @@ jobs: # echo "VERSION=$env:VERSION" >> $env:GITHUB_ENV # - uses: actions/setup-node@v6 # with: - # node-version: 25 + # node-version: 26 # - uses: pnpm/action-setup@v6 # with: - # version: 10 + # version: 11 # run_install: false # - name: Get pnpm store directory # shell: bash # run: echo "STORE_PATH=$(pnpm store path --silent)" >> ${GITHUB_ENV} - # - uses: actions/cache@v5 - # name: Setup pnpm cache - # with: - # path: ${{ env.STORE_PATH }} - # key: ${{ runner.os }}-pnpm-build-store-${{ hashFiles('**/pnpm-lock.yaml') }} - # restore-keys: | - # ${{ runner.os }}-pnpm-build-store- # - name: Install deps # run: pnpm install --frozen-lockfile # - uses: dtolnay/rust-toolchain@stable diff --git a/src-tauri/build.rs b/src-tauri/build.rs index 3be5441f..0bbd4977 100644 --- a/src-tauri/build.rs +++ b/src-tauri/build.rs @@ -3,6 +3,12 @@ use vergen_git2::{Emitter, Git2Builder}; fn main() -> Result<(), Box> { println!("cargo:rerun-if-env-changed=DEFGUARD_CLIENT_BUILD_VERSION"); + println!("cargo:rerun-if-env-changed=DEFGUARD_CLIENT_DEV"); + println!("cargo::rustc-check-cfg=cfg(defguard_client_dev)"); + if std::env::var("DEFGUARD_CLIENT_DEV").is_ok() { + println!("cargo::rustc-cfg=defguard_client_dev"); + } + // set VERGEN_GIT_SHA env variable based on git commit hash let git2 = Git2Builder::default().branch(true).sha(true).build()?; Emitter::default().add_instructions(&git2)?.emit()?; diff --git a/src-tauri/src/bin/defguard-client.rs b/src-tauri/src/bin/defguard-client.rs index 6766108f..0d0bf13e 100644 --- a/src-tauri/src/bin/defguard-client.rs +++ b/src-tauri/src/bin/defguard-client.rs @@ -348,7 +348,7 @@ fn main() { app.manage(state); // Open new UI window. - let new_url = if cfg!(debug_assertions) { + let new_url = if cfg!(defguard_client_dev) { WebviewUrl::External("http://localhost:5072".parse().unwrap()) } else { WebviewUrl::App("new-ui/".into()) @@ -360,7 +360,7 @@ fn main() { .build()?; // Open old UI window. - let old_url = if cfg!(debug_assertions) { + let old_url = if cfg!(defguard_client_dev) { WebviewUrl::External("http://localhost:5071".parse().unwrap()) } else { WebviewUrl::App("old-ui/index.html/".into()) diff --git a/src-tauri/src/window.rs b/src-tauri/src/window.rs index 1064516e..e4fce3fb 100644 --- a/src-tauri/src/window.rs +++ b/src-tauri/src/window.rs @@ -13,7 +13,7 @@ pub const OLD_UI_WIDTH: f64 = 920.0; pub const OLD_UI_HEIGHT: f64 = 720.0; fn new_ui_url() -> WebviewUrl { - if cfg!(debug_assertions) { + if cfg!(defguard_client_dev) { WebviewUrl::External("http://localhost:5072".parse().unwrap()) } else { WebviewUrl::App("new-ui/".into()) @@ -21,7 +21,7 @@ fn new_ui_url() -> WebviewUrl { } fn old_ui_url() -> WebviewUrl { - if cfg!(debug_assertions) { + if cfg!(defguard_client_dev) { WebviewUrl::External("http://localhost:5071".parse().unwrap()) } else { WebviewUrl::App("old-ui/index.html".into())