diff --git a/.github/workflows/tauri_ci.yaml b/.github/workflows/tauri_ci.yaml index 7045e58aa1..8d99091aab 100644 --- a/.github/workflows/tauri_ci.yaml +++ b/.github/workflows/tauri_ci.yaml @@ -25,32 +25,33 @@ jobs: platform: [ubuntu-latest] runs-on: ${{ matrix.platform }} + + env: + CI: true steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 + + - name: Maximize build space (ubuntu only) + if: matrix.platform == 'ubuntu-latest' + run: | + sudo rm -rf /usr/share/dotnet + sudo rm -rf /opt/ghc + sudo rm -rf "/usr/local/share/boost" + sudo rm -rf "$AGENT_TOOLSDIRECTORY" + sudo docker image prune --all --force + sudo rm -rf /opt/hostedtoolcache/codeQL + sudo rm -rf ${GITHUB_WORKSPACE}/.git + sudo rm -rf $ANDROID_HOME/ndk + - name: setup node uses: actions/setup-node@v3 with: node-version: ${{ env.NODE_VERSION }} - - name: Cache Rust Dependencies - uses: Swatinem/rust-cache@v2 + - name: setup pnpm + uses: pnpm/action-setup@v2 with: - key: rust-dependencies-${{ runner.os }} - workspaces: | - frontend/rust-lib - frontend/appflowy_tauri/src-tauri - - - name: Cache Node.js dependencies - uses: actions/cache@v2 - with: - path: ~/.npm - key: npm-${{ runner.os }} - - - name: Cache node_modules - uses: actions/cache@v2 - with: - path: frontend/appflowy_tauri/node_modules - key: node-modules-${{ runner.os }} + version: ${{ env.PNPM_VERSION }} - name: Install Rust toolchain id: rust_toolchain @@ -60,15 +61,23 @@ jobs: override: true profile: minimal + - name: Rust cache + uses: swatinem/rust-cache@v2 + with: + workspaces: "./frontend/appflowy_tauri/src-tauri -> target" + + - name: Node_modules cache + uses: actions/cache@v2 + with: + path: frontend/appflowy_tauri/node_modules + key: node-modules-${{ runner.os }} + - name: install dependencies (windows only) if: matrix.platform == 'windows-latest' working-directory: frontend run: | - cargo install --force cargo-make cargo install --force duckscript_cli vcpkg integrate install - cargo make appflowy-tauri-deps-tools - npm install -g pnpm@${{ env.PNPM_VERSION }} - name: install dependencies (ubuntu only) if: matrix.platform == 'ubuntu-latest' @@ -76,35 +85,29 @@ jobs: run: | sudo apt-get update sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev libappindicator3-dev librsvg2-dev patchelf - cargo install --force cargo-make - cargo make appflowy-tauri-deps-tools - npm install -g pnpm@${{ env.PNPM_VERSION }} - - name: install dependencies (macOS only) - if: matrix.platform == 'macos-latest' + - name: install cargo-make working-directory: frontend run: | cargo install --force cargo-make cargo make appflowy-tauri-deps-tools - npm install -g pnpm@${{ env.PNPM_VERSION }} - - name: Build + - name: install frontend dependencies working-directory: frontend/appflowy_tauri run: | mkdir dist pnpm install cargo make --cwd .. tauri_build + + - name: frontend tests and linting + working-directory: frontend/appflowy_tauri + run: | pnpm test pnpm test:errors - - name: Check for uncommitted changes - run: | - diff_files=$(git status --porcelain) - if [ -n "$diff_files" ]; then - echo "There are uncommitted changes in the working tree. Please commit them before pushing." - exit 1 - fi - - uses: tauri-apps/tauri-action@v0 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tauriScript: pnpm tauri + projectPath: frontend/appflowy_tauri \ No newline at end of file diff --git a/.github/workflows/tauri_release.yml b/.github/workflows/tauri_release.yml new file mode 100644 index 0000000000..e031e65ccd --- /dev/null +++ b/.github/workflows/tauri_release.yml @@ -0,0 +1,153 @@ +name: Publish Tauri Release + +on: + workflow_dispatch: + inputs: + branch: + description: 'The branch to release' + required: true + default: 'main' + version: + description: 'The version to release' + required: true + default: '0.0.0' +env: + NODE_VERSION: "18.16.0" + PNPM_VERSION: "8.5.0" + RUST_TOOLCHAIN: "1.75" + +jobs: + + publish-tauri: + permissions: + contents: write + strategy: + fail-fast: false + matrix: + settings: + - platform: windows-latest + args: "--verbose" + target: "windows-x86_64" + - platform: macos-latest + args: "--target x86_64-apple-darwin" + target: "macos-x86_64" + - platform: ubuntu-latest + args: "--target x86_64-unknown-linux-gnu" + target: "linux-x86_64" + + runs-on: ${{ matrix.settings.platform }} + + env: + CI: true + PACKAGE_PREFIX: AppFlowy_Tauri-${{ github.event.inputs.version }}-${{ matrix.settings.target }} + steps: + - uses: actions/checkout@v4 + with: + ref: ${{ github.event.inputs.branch }} + + - name: Maximize build space (ubuntu only) + if: matrix.settings.platform == 'ubuntu-latest' + run: | + sudo rm -rf /usr/share/dotnet + sudo rm -rf /opt/ghc + sudo rm -rf "/usr/local/share/boost" + sudo rm -rf "$AGENT_TOOLSDIRECTORY" + sudo docker image prune --all --force + sudo rm -rf /opt/hostedtoolcache/codeQL + sudo rm -rf ${GITHUB_WORKSPACE}/.git + sudo rm -rf $ANDROID_HOME/ndk + + - name: setup node + uses: actions/setup-node@v3 + with: + node-version: ${{ env.NODE_VERSION }} + + - name: setup pnpm + uses: pnpm/action-setup@v2 + with: + version: ${{ env.PNPM_VERSION }} + + - name: Install Rust toolchain + id: rust_toolchain + uses: actions-rs/toolchain@v1 + with: + toolchain: ${{ env.RUST_TOOLCHAIN }} + override: true + profile: minimal + + - name: Rust cache + uses: swatinem/rust-cache@v2 + with: + workspaces: "./frontend/appflowy_tauri/src-tauri -> target" + + - name: install dependencies (windows only) + if: matrix.settings.platform == 'windows-latest' + working-directory: frontend + run: | + cargo install --force duckscript_cli + vcpkg integrate install + + - name: install dependencies (ubuntu only) + if: matrix.settings.platform == 'ubuntu-latest' + working-directory: frontend + run: | + sudo apt-get update + sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.0-dev libappindicator3-dev librsvg2-dev patchelf + + - name: install cargo-make + working-directory: frontend + run: | + cargo install --force cargo-make + cargo make appflowy-tauri-deps-tools + + - name: install frontend dependencies + working-directory: frontend/appflowy_tauri + run: | + mkdir dist + pnpm install + pnpm exec node scripts/update_version.cjs ${{ github.event.inputs.version }} + cargo make --cwd .. tauri_build + + - uses: tauri-apps/tauri-action@dev + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + APPLE_CERTIFICATE: ${{ secrets.MACOS_CERTIFICATE }} + APPLE_CERTIFICATE_PASSWORD: ${{ secrets.MACOS_CERTIFICATE_PWD }} + APPLE_SIGNING_IDENTITY: ${{ secrets.MACOS_TEAM_ID }} + APPLE_ID: ${{ secrets.MACOS_NOTARY_USER }} + APPLE_TEAM_ID: ${{ secrets.MACOS_TEAM_ID }} + APPLE_PASSWORD: ${{ secrets.MACOS_NOTARY_PWD }} + CI: true + with: + args: ${{ matrix.settings.args }} + appVersion: ${{ github.event.inputs.version }} + tauriScript: pnpm tauri + projectPath: frontend/appflowy_tauri + + - name: Upload EXE package(windows only) + uses: actions/upload-artifact@v4 + if: matrix.settings.platform == 'windows-latest' + with: + name: ${{ env.PACKAGE_PREFIX }}.exe + path: frontend/appflowy_tauri/src-tauri/target/release/bundle/nsis/AppFlowy_${{ github.event.inputs.version }}_x64-setup.exe + + - name: Upload DMG package(macos only) + uses: actions/upload-artifact@v4 + if: matrix.settings.platform == 'macos-latest' + with: + name: ${{ env.PACKAGE_PREFIX }}.dmg + path: frontend/appflowy_tauri/src-tauri/target/x86_64-apple-darwin/release/bundle/dmg/AppFlowy_${{ github.event.inputs.version }}_x64.dmg + + - name: Upload Deb package(ubuntu only) + uses: actions/upload-artifact@v4 + if: matrix.settings.platform == 'ubuntu-latest' + with: + name: ${{ env.PACKAGE_PREFIX }}.deb + path: frontend/appflowy_tauri/src-tauri/target/x86_64-unknown-linux-gnu/release/bundle/deb/app-flowy_${{ github.event.inputs.version }}_amd64.deb + + - name: Upload AppImage package(ubuntu only) + uses: actions/upload-artifact@v4 + if: matrix.settings.platform == 'ubuntu-latest' + with: + name: ${{ env.PACKAGE_PREFIX }}.AppImage + path: frontend/appflowy_tauri/src-tauri/target/x86_64-unknown-linux-gnu/release/bundle/appimage/app-flowy_${{ github.event.inputs.version }}_amd64.AppImage diff --git a/frontend/appflowy_tauri/package.json b/frontend/appflowy_tauri/package.json index 6f8ed203a0..c9f8327f83 100644 --- a/frontend/appflowy_tauri/package.json +++ b/frontend/appflowy_tauri/package.json @@ -79,8 +79,8 @@ "yjs": "^13.5.51" }, "devDependencies": { - "@svgr/plugin-svgo": "^8.0.1", "@tauri-apps/cli": "^1.5.6", + "@svgr/plugin-svgo": "^8.0.1", "@types/google-protobuf": "^3.15.12", "@types/is-hotkey": "^0.1.7", "@types/jest": "^29.5.3", diff --git a/frontend/appflowy_tauri/scripts/update_version.cjs b/frontend/appflowy_tauri/scripts/update_version.cjs new file mode 100644 index 0000000000..498b8c3e4f --- /dev/null +++ b/frontend/appflowy_tauri/scripts/update_version.cjs @@ -0,0 +1,31 @@ +const fs = require('fs'); +const path = require('path'); + +if (process.argv.length < 3) { + console.error('Usage: node update-tauri-version.js '); + process.exit(1); +} + +const newVersion = process.argv[2]; + +const tauriConfigPath = path.join(__dirname, '../src-tauri', 'tauri.conf.json'); + +fs.readFile(tauriConfigPath, 'utf8', (err, data) => { + if (err) { + console.error('Error reading tauri.conf.json:', err); + return; + } + + const config = JSON.parse(data); + + config.package.version = newVersion; + + fs.writeFile(tauriConfigPath, JSON.stringify(config, null, 2), 'utf8', (err) => { + if (err) { + console.error('Error writing tauri.conf.json:', err); + return; + } + + console.log(`Tauri version updated to ${newVersion} successfully.`); + }); +}); diff --git a/frontend/appflowy_tauri/src-tauri/tauri.conf.json b/frontend/appflowy_tauri/src-tauri/tauri.conf.json index 899bbeeb41..293da0ec70 100644 --- a/frontend/appflowy_tauri/src-tauri/tauri.conf.json +++ b/frontend/appflowy_tauri/src-tauri/tauri.conf.json @@ -99,4 +99,4 @@ } ] } -} +} \ No newline at end of file diff --git a/frontend/appflowy_tauri/src/appflowy_app/components/_shared/confirm_dialog/DeleteConfirmDialog.tsx b/frontend/appflowy_tauri/src/appflowy_app/components/_shared/confirm_dialog/DeleteConfirmDialog.tsx index 9a2d0dd882..058335d30c 100644 --- a/frontend/appflowy_tauri/src/appflowy_app/components/_shared/confirm_dialog/DeleteConfirmDialog.tsx +++ b/frontend/appflowy_tauri/src/appflowy_app/components/_shared/confirm_dialog/DeleteConfirmDialog.tsx @@ -60,6 +60,7 @@ function DeleteConfirmDialog({ open, title, onOk, onCancel, onClose, okText, can