From fe982c32f37cfcd93073e42c9f585f82c0e47a2f Mon Sep 17 00:00:00 2001 From: Tom Hicks Date: Fri, 6 Nov 2026 15:50:21 -0800 Subject: [PATCH 1/7] NUT-025: Optimize CI workflow with fast-forward commit reuse and git notes metadata --- .github/workflows/ci.yml | 177 ++++++++++++++++++++++++++++++++++++++- Tasks.md | 21 +++++ 2 files changed, 195 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c79b67c..1e22ec5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,9 +2,18 @@ name: CI on: push: - branches: [ "main", "phase-*" ] + branches: ["main", "staging", "develop"] pull_request: - branches: [ "main" ] + branches: ["main", "staging", "develop"] + +permissions: + contents: write + statuses: write + checks: read + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: ${{ github.event_name == 'pull_request' }} jobs: test: @@ -14,34 +23,196 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest, macos-latest, windows-latest] + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + TARGET_SHA: ${{ github.event.pull_request.head.sha || github.sha }} + CHECK_KEY: ci/${{ matrix.os }} steps: - name: Checkout repository uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.sha || github.sha }} + fetch-depth: 0 + + - name: Check commit CI status and fast-forward eligibility + id: check_cache + shell: bash + run: | + set -euo pipefail + + echo "Evaluating commit ${TARGET_SHA} for ${CHECK_KEY} (event: ${GITHUB_EVENT_NAME})" + + IS_FF="true" + if [ "${GITHUB_EVENT_NAME}" = "pull_request" ]; then + BASE_REF="${{ github.event.pull_request.base.ref }}" + BASE_SHA="${{ github.event.pull_request.base.sha }}" + git fetch origin "${BASE_REF}" 2>/dev/null || true + + if git merge-base --is-ancestor "${BASE_SHA}" "${TARGET_SHA}"; then + echo "PR head ${TARGET_SHA} is a fast-forward of ${BASE_REF} (${BASE_SHA})." + else + IS_FF="false" + echo "::notice::PR head ${TARGET_SHA} is not currently a fast-forward of ${BASE_REF} (${BASE_SHA})." + fi + fi + + # 1. Check Git Notes (refs/notes/ci) on TARGET_SHA + git fetch origin refs/notes/ci:refs/notes/ci 2>/dev/null || true + NOTE_CONTENT="$(git notes --ref=ci show "${TARGET_SHA}" 2>/dev/null || true)" + NOTE_PASSED="false" + if [ -n "${NOTE_CONTENT}" ] && grep -q "^${CHECK_KEY}=passed" <<< "${NOTE_CONTENT}"; then + NOTE_PASSED="true" + echo "Found existing Git note in refs/notes/ci: ${CHECK_KEY}=passed on ${TARGET_SHA}" + fi + + # 2. Check GitHub Commit Statuses on TARGET_SHA + STATUS_STATE="$(gh api "repos/${GITHUB_REPOSITORY}/commits/${TARGET_SHA}/status" \ + --jq ".statuses[] | select(.context == \"${CHECK_KEY}\") | .state" 2>/dev/null | head -n 1 || true)" + STATUS_PASSED="false" + if [ "${STATUS_STATE}" = "success" ]; then + STATUS_PASSED="true" + echo "Found existing GitHub commit status: ${CHECK_KEY}=success on ${TARGET_SHA}" + fi + + if [ "${IS_FF}" = "true" ] && { [ "${NOTE_PASSED}" = "true" ] || [ "${STATUS_PASSED}" = "true" ]; }; then + echo "Check ${CHECK_KEY} already passed for fast-forward commit ${TARGET_SHA}; skipping build steps." + echo "skip_build=true" >> "${GITHUB_OUTPUT}" + else + echo "Check ${CHECK_KEY} has not yet been verified for ${TARGET_SHA}; running build and tests." + echo "skip_build=false" >> "${GITHUB_OUTPUT}" + fi - name: Install Rust stable + if: steps.check_cache.outputs.skip_build != 'true' uses: dtolnay/rust-toolchain@stable - name: Setup Rust cache + if: steps.check_cache.outputs.skip_build != 'true' uses: Swatinem/rust-cache@v2 - name: Install Linux dependencies - if: runner.os == 'Linux' + if: runner.os == 'Linux' && steps.check_cache.outputs.skip_build != 'true' run: | sudo apt-get update sudo apt-get install -y libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf libssl-dev - name: Setup Node.js + if: steps.check_cache.outputs.skip_build != 'true' uses: actions/setup-node@v4 with: node-version: 20 - name: Install GUI frontend dependencies + if: steps.check_cache.outputs.skip_build != 'true' working-directory: gui run: npm ci - name: Build GUI frontend + if: steps.check_cache.outputs.skip_build != 'true' working-directory: gui run: npm run build - name: Run Workspace Tests + if: steps.check_cache.outputs.skip_build != 'true' run: cargo test --workspace --verbose + + - name: Record passed check metadata (Commit Status & Git Notes) + if: success() + shell: bash + run: | + set -euo pipefail + + RUN_URL="${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}" + + # 1. Record GitHub Commit Status on TARGET_SHA for branch protection & PR merge checks + gh api "repos/${GITHUB_REPOSITORY}/statuses/${TARGET_SHA}" \ + -f state="success" \ + -f context="${CHECK_KEY}" \ + -f description="CI passed on ${{ matrix.os }}" \ + -f target_url="${RUN_URL}" >/dev/null || { + echo "::warning::Could not post commit status for ${TARGET_SHA} (e.g. fork PR with read-only token)." + } + + # 2. Record metadata in Git Notes (refs/notes/ci) on TARGET_SHA + git config user.name "github-actions[bot]" + git config user.email "41898282+github-actions[bot]@users.noreply.github.com" + + for attempt in 1 2 3 4 5; do + git fetch origin refs/notes/ci:refs/notes/ci 2>/dev/null || true + EXISTING_NOTE="$(git notes --ref=ci show "${TARGET_SHA}" 2>/dev/null || true)" + + if [ -n "${EXISTING_NOTE}" ] && grep -q "^${CHECK_KEY}=passed" <<< "${EXISTING_NOTE}"; then + echo "Git note ${CHECK_KEY}=passed already recorded on ${TARGET_SHA}." + break + fi + + NEW_LINE="${CHECK_KEY}=passed timestamp=$(date -u +%Y-%m-%dT%H:%M:%SZ) run_id=${GITHUB_RUN_ID} event=${GITHUB_EVENT_NAME}" + if [ -n "${EXISTING_NOTE}" ]; then + UPDATED_NOTE="$(printf '%s\n%s\n' "${EXISTING_NOTE}" "${NEW_LINE}")" + else + UPDATED_NOTE="${NEW_LINE}" + fi + + git notes --ref=ci add -f -m "${UPDATED_NOTE}" "${TARGET_SHA}" + + if [ "${ACT:-false}" = "true" ]; then + echo "Running locally under act; recorded ${CHECK_KEY}=passed in local refs/notes/ci for ${TARGET_SHA} (skipping remote push)." + break + fi + + if git push origin refs/notes/ci:refs/notes/ci 2>/dev/null; then + echo "Recorded ${CHECK_KEY}=passed in refs/notes/ci for ${TARGET_SHA}." + break + fi + + if [ "${attempt}" -eq 5 ]; then + echo "::warning::Could not push refs/notes/ci after ${attempt} attempts." + break + fi + + echo "Contention pushing refs/notes/ci (attempt ${attempt}/5), retrying..." + sleep $((attempt * 2)) + done + + - name: Record failed check status + if: failure() + shell: bash + run: | + RUN_URL="${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}" + gh api "repos/${GITHUB_REPOSITORY}/statuses/${TARGET_SHA}" \ + -f state="failure" \ + -f context="${CHECK_KEY}" \ + -f description="CI failed on ${{ matrix.os }}" \ + -f target_url="${RUN_URL}" >/dev/null || true + + ci-gate: + name: CI Merge Gate + needs: [test] + if: always() + runs-on: ubuntu-latest + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + TARGET_SHA: ${{ github.event.pull_request.head.sha || github.sha }} + steps: + - name: Verify all CI checks passed + shell: bash + run: | + set -euo pipefail + RUN_URL="${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}" + + if [ "${{ needs.test.result }}" != "success" ]; then + gh api "repos/${GITHUB_REPOSITORY}/statuses/${TARGET_SHA}" \ + -f state="failure" \ + -f context="ci/gate" \ + -f description="One or more CI platform checks failed or were cancelled" \ + -f target_url="${RUN_URL}" >/dev/null || true + echo "::error::CI platform checks did not succeed (result: ${{ needs.test.result }})." + exit 1 + fi + + gh api "repos/${GITHUB_REPOSITORY}/statuses/${TARGET_SHA}" \ + -f state="success" \ + -f context="ci/gate" \ + -f description="All CI platform checks verified" \ + -f target_url="${RUN_URL}" >/dev/null || true + echo "All CI platform checks verified for ${TARGET_SHA}." diff --git a/Tasks.md b/Tasks.md index 6399100..b9e53d8 100644 --- a/Tasks.md +++ b/Tasks.md @@ -94,6 +94,7 @@ This document defines the complete project roadmap and task tracking system for | [NUT-021](#nut-021) | Support Headless & SSH Remote Authentication Modes | Fixed | Feature | | [NUT-022](#nut-022) | Implement CLI Shell Completions Generation | Fixed | Feature | | [NUT-023](#nut-023) | Write Comprehensive CLI Documentation and Automation Guides | Fixed | Chore | +| [NUT-025](#nut-025) | Optimize CI Workflow with Fast-Forward Commit Reuse and Git Notes Metadata | Fixed | Chore | --- @@ -587,6 +588,26 @@ Create a containerized integration test harness using Docker or Podman to spin u - NUT-011 - NUT-021 + + +### Optimize CI Workflow with Fast-Forward Commit Reuse and Git Notes Metadata +**ID:** NUT-025 +**Status:** Fixed +**Type:** Chore + +**Description:** +Enhance the GitHub Actions CI workflow (`.github/workflows/ci.yml`) to build on pushes and pull requests to `main`, `staging`, and `develop`, avoid redundant rebuilds of fast-forward commits that have already passed CI, record per-OS check completion via GitHub Commit Statuses and Git Notes (`refs/notes/ci`), and expose a unified merge-check gate job for branch protection. + +**Requirements:** +- [x] Configure concurrency control in `.github/workflows/ci.yml` to cancel superseded PR runs +- [x] Resolve the true commit SHA (`pull_request.head.sha` on PRs, `github.sha` on pushes) and verify fast-forward ancestry against the target base branch on PRs +- [x] Check existing GitHub Commit Statuses (`ci/`) and Git Notes (`refs/notes/ci`) before running heavy build/test steps so already-verified checks skip cleanly on fast-forward merges and flaky reruns +- [x] Record passed per-OS checks to both GitHub Commit Statuses (`ci/`) and `refs/notes/ci` (with retry-safe atomic push) +- [x] Add a final `ci-gate` job suitable for GitHub Branch Protection required merge checks on `main`, `staging`, and `develop` + +**Dependencies:** +- NUT-001 + --- From 2ec74308eac6c80cba418fd9f0aaf9188fd3104c Mon Sep 17 00:00:00 2001 From: Tom Hicks Date: Fri, 6 Nov 2026 16:24:44 -0800 Subject: [PATCH 2/7] Fix GUI npm install and Ubuntu 24.04 packages in GitHub Actions workflows - Replace with in and since is not tracked. - Replace obsolete with and add for (Ubuntu 24.04) builds. - Use when fetching CI git notes so concurrent matrix runners cleanly update local note refs on retry. --- .github/workflows/ci.yml | 8 ++++---- .github/workflows/release.yml | 4 ++-- package-lock.json | 6 ++++++ 3 files changed, 12 insertions(+), 6 deletions(-) create mode 100644 package-lock.json diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1e22ec5..1e6f98a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -57,7 +57,7 @@ jobs: fi # 1. Check Git Notes (refs/notes/ci) on TARGET_SHA - git fetch origin refs/notes/ci:refs/notes/ci 2>/dev/null || true + git fetch origin +refs/notes/ci:refs/notes/ci 2>/dev/null || true NOTE_CONTENT="$(git notes --ref=ci show "${TARGET_SHA}" 2>/dev/null || true)" NOTE_PASSED="false" if [ -n "${NOTE_CONTENT}" ] && grep -q "^${CHECK_KEY}=passed" <<< "${NOTE_CONTENT}"; then @@ -94,7 +94,7 @@ jobs: if: runner.os == 'Linux' && steps.check_cache.outputs.skip_build != 'true' run: | sudo apt-get update - sudo apt-get install -y libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf libssl-dev + sudo apt-get install -y libwebkit2gtk-4.1-dev libayatana-appindicator3-dev librsvg2-dev patchelf libssl-dev libdbus-1-dev pkg-config - name: Setup Node.js if: steps.check_cache.outputs.skip_build != 'true' @@ -105,7 +105,7 @@ jobs: - name: Install GUI frontend dependencies if: steps.check_cache.outputs.skip_build != 'true' working-directory: gui - run: npm ci + run: npm install - name: Build GUI frontend if: steps.check_cache.outputs.skip_build != 'true' @@ -138,7 +138,7 @@ jobs: git config user.email "41898282+github-actions[bot]@users.noreply.github.com" for attempt in 1 2 3 4 5; do - git fetch origin refs/notes/ci:refs/notes/ci 2>/dev/null || true + git fetch origin +refs/notes/ci:refs/notes/ci 2>/dev/null || true EXISTING_NOTE="$(git notes --ref=ci show "${TARGET_SHA}" 2>/dev/null || true)" if [ -n "${EXISTING_NOTE}" ] && grep -q "^${CHECK_KEY}=passed" <<< "${EXISTING_NOTE}"; then diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 56157b1..b2b7304 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -120,11 +120,11 @@ jobs: if: runner.os == 'Linux' run: | sudo apt-get update - sudo apt-get install -y libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf libssl-dev rpm + sudo apt-get install -y libwebkit2gtk-4.1-dev libayatana-appindicator3-dev librsvg2-dev patchelf libssl-dev libdbus-1-dev pkg-config rpm - name: Install frontend dependencies working-directory: gui - run: npm ci + run: npm install - name: Build Tauri GUI uses: tauri-apps/tauri-action@v0 diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..e868e99 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,6 @@ +{ + "name": "NextcloudUploadTool", + "lockfileVersion": 3, + "requires": true, + "packages": {} +} From 437f3964480899506c9810564a6d9715e0f73b0d Mon Sep 17 00:00:00 2001 From: Tom Hicks Date: Fri, 6 Nov 2026 16:36:40 -0800 Subject: [PATCH 3/7] Enable xdg-portal backend feature for rfd on Linux --- Cargo.lock | 14 ++++++++++++++ gui/src-tauri/Cargo.toml | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index 7598294..40e6c5f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2979,6 +2979,12 @@ dependencies = [ "windows-sys 0.61.2", ] +[[package]] +name = "pollster" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f3a9f18d041e6d0e102a0a46750538147e5e8992d3b4873aaafee2520b00ce3" + [[package]] name = "portable-atomic" version = "1.15.0" @@ -3312,7 +3318,9 @@ dependencies = [ "objc2-app-kit", "objc2-core-foundation", "objc2-foundation", + "pollster", "raw-window-handle", + "urlencoding", "wasm-bindgen", "wasm-bindgen-futures", "web-sys", @@ -4805,6 +4813,12 @@ dependencies = [ "serde_derive", ] +[[package]] +name = "urlencoding" +version = "2.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "daf8dba3b7eb870caf1ddeed7bc9d2a049f3cfdfae7cb521b087cc33ae4c49da" + [[package]] name = "urlpattern" version = "0.3.0" diff --git a/gui/src-tauri/Cargo.toml b/gui/src-tauri/Cargo.toml index 1f26e3e..5bc8539 100644 --- a/gui/src-tauri/Cargo.toml +++ b/gui/src-tauri/Cargo.toml @@ -24,5 +24,5 @@ tauri-plugin-opener = "2" serde = { version = "1", features = ["derive"] } serde_json = "1" reqwest = { version = "0.12", features = ["json"] } -rfd = { version = "0.15", default-features = false, features = ["tokio"] } +rfd = { version = "0.15", default-features = false, features = ["xdg-portal", "tokio"] } open = "5" From 966ae290bf4bd62a7fbaa5d6830a3469bebcd323 Mon Sep 17 00:00:00 2001 From: Tom Hicks Date: Fri, 6 Nov 2026 16:59:37 -0800 Subject: [PATCH 4/7] Fix release workflow and add NUT-026 for GitHub Pages React website --- .github/workflows/release.yml | 7 +++++-- Cargo.lock | 13 +++++++++++++ Tasks.md | 22 ++++++++++++++++++++++ nextcloud_client/Cargo.toml | 2 +- 4 files changed, 41 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b2b7304..0758ca2 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -54,7 +54,9 @@ jobs: - name: Install cross if: matrix.use_cross - run: cargo install cross --git https://github.com/cross-rs/cross + uses: taiki-e/install-action@v2 + with: + tool: cross - name: Build static CLI binary (with cross) if: matrix.use_cross @@ -150,11 +152,12 @@ jobs: uses: actions/download-artifact@v4 with: path: artifacts + merge-multiple: true - name: Generate Checksums run: | cd artifacts - find . -type f -name "*.tar.gz" -o -name "*.zip" -exec sha256sum {} + > SHA256SUMS + find . -maxdepth 1 -type f \( -name "*.tar.gz" -o -name "*.zip" \) -exec sha256sum {} + > SHA256SUMS cat SHA256SUMS - name: Upload Checksums to GitHub Release diff --git a/Cargo.lock b/Cargo.lock index 40e6c5f..1841f32 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -817,6 +817,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "708b509edf7889e53d7efb0ffadd994cc6c2345ccb62f55cfd6b0682165e4fa6" dependencies = [ "dbus", + "openssl", "zeroize", ] @@ -2222,6 +2223,7 @@ dependencies = [ "byteorder", "dbus-secret-service", "log", + "openssl", "security-framework 2.11.1", "security-framework 3.7.0", "windows-sys 0.60.2", @@ -2264,6 +2266,7 @@ version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "328c4789d42200f1eeec05bd86c9c13c7f091d2ba9a6ea35acdf51f31bc0f043" dependencies = [ + "cc", "pkg-config", ] @@ -2762,6 +2765,15 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7c87def4c32ab89d880effc9e097653c8da5d6ef28e6b539d313baaacfbafcbe" +[[package]] +name = "openssl-src" +version = "300.6.1+3.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46eb8fb9fb3b61ce1c0f8a026c4c1a0714d3a9e138e7fbde78753ce2babc3846" +dependencies = [ + "cc", +] + [[package]] name = "openssl-sys" version = "0.9.117" @@ -2770,6 +2782,7 @@ checksum = "b47e7e6bb2c38cd930d25a23b40fa52e068c10e85f3e03a7f5ba5aaca5713695" dependencies = [ "cc", "libc", + "openssl-src", "pkg-config", "vcpkg", ] diff --git a/Tasks.md b/Tasks.md index b9e53d8..bd61f79 100644 --- a/Tasks.md +++ b/Tasks.md @@ -72,6 +72,7 @@ This document defines the complete project roadmap and task tracking system for |---|---|---|---| | [NUT-019](#nut-019) | Implement Homebrew/Winget/Chocolatey Manifests | Triage | Chore | | [NUT-024](#nut-024) | Create Docker/Podman Nextcloud Integration Test Harness | Triage | Foundation | +| [NUT-026](#nut-026) | Build React Documentation & Marketing Website on GitHub Pages | Triage | Feature | | [NUT-001](#nut-001) | Establish Repository Structure | Fixed | Foundation | | [NUT-002](#nut-002) | Implement Shared Rust Backend Library | Fixed | Foundation | | [NUT-003](#nut-003) | Implement WebDAV Upload Logic | Fixed | Feature | @@ -608,6 +609,27 @@ Enhance the GitHub Actions CI workflow (`.github/workflows/ci.yml`) to build on **Dependencies:** - NUT-001 + + +### Build React Documentation & Marketing Website on GitHub Pages +**ID:** NUT-026 +**Status:** Triage +**Type:** Feature + +**Description:** +Create a React-based project website hosted via GitHub Pages at `https://headhunter45.github.io/NextcloudUploadTool` featuring project marketing/presentation content, interactive examples, and comprehensive CLI/GUI documentation, and integrate automatic website deployment into the release workflow. + +**Requirements:** +- [ ] Scaffold React static site configured for GitHub Pages base path (`/NextcloudUploadTool/`) and URL (`https://headhunter45.github.io/NextcloudUploadTool`) +- [ ] Create landing/marketing presentation page highlighting key CLI and GUI features, screenshots/walkthroughs, and download links +- [ ] Integrate project documentation (`docs/cli-reference.md`, `docs/automation-recipes.md`, `docs/installation.md`, `docs/gui-guide.md`, `docs/multi-account.md`, `docs/architecture.md`) and usage examples +- [ ] Update `.github/workflows/release.yml` to build and publish the website to GitHub Pages when a release is published + +**Dependencies:** +- NUT-018 +- NUT-020 +- NUT-023 + --- diff --git a/nextcloud_client/Cargo.toml b/nextcloud_client/Cargo.toml index 1825202..e60093d 100644 --- a/nextcloud_client/Cargo.toml +++ b/nextcloud_client/Cargo.toml @@ -14,6 +14,6 @@ serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" thiserror = "2.0" url = { version = "2.5", features = ["serde"] } -keyring = { version = "3", features = ["apple-native", "windows-native", "sync-secret-service"] } +keyring = { version = "3", features = ["apple-native", "windows-native", "sync-secret-service", "vendored"] } dirs = "6.0" open = "5.3" From a96fc3f0564367ddeb0649c63a0a5154380a6eb5 Mon Sep 17 00:00:00 2001 From: Tom Hicks Date: Fri, 6 Nov 2026 18:09:13 -0800 Subject: [PATCH 5/7] Vendor OpenSSL for reqwest musl builds and pin Tauri minor versions --- cli/Cargo.toml | 2 +- gui/package.json | 6 +++--- gui/src-tauri/Cargo.toml | 4 ++-- nextcloud_client/Cargo.toml | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/cli/Cargo.toml b/cli/Cargo.toml index 55b361b..756a525 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -8,7 +8,7 @@ nextcloud_client = { path = "../nextcloud_client" } clap = { version = "4.5", features = ["derive", "cargo"] } clap_complete = "4.5" tokio = { version = "1", features = ["full"] } -reqwest = { version = "0.12", default-features = false, features = ["json", "default-tls"] } +reqwest = { version = "0.12", default-features = false, features = ["json", "default-tls", "native-tls-vendored"] } open = "5.3" url = "2.5" serde = { version = "1.0", features = ["derive"] } diff --git a/gui/package.json b/gui/package.json index bad53e6..a4aceaa 100644 --- a/gui/package.json +++ b/gui/package.json @@ -12,8 +12,8 @@ "dependencies": { "react": "^19.1.0", "react-dom": "^19.1.0", - "@tauri-apps/api": "^2", - "@tauri-apps/plugin-opener": "^2" + "@tauri-apps/api": "~2.11.1", + "@tauri-apps/plugin-opener": "~2.5.4" }, "devDependencies": { "@types/react": "^19.1.8", @@ -21,6 +21,6 @@ "@vitejs/plugin-react": "^4.6.0", "typescript": "~5.8.3", "vite": "^7.0.4", - "@tauri-apps/cli": "^2" + "@tauri-apps/cli": "~2.11.4" } } diff --git a/gui/src-tauri/Cargo.toml b/gui/src-tauri/Cargo.toml index 5bc8539..206863b 100644 --- a/gui/src-tauri/Cargo.toml +++ b/gui/src-tauri/Cargo.toml @@ -19,8 +19,8 @@ tauri-build = { version = "2", features = [] } [dependencies] nextcloud_client = { path = "../../nextcloud_client" } -tauri = { version = "2", features = [] } -tauri-plugin-opener = "2" +tauri = { version = "~2.11.5", features = [] } +tauri-plugin-opener = "~2.5.4" serde = { version = "1", features = ["derive"] } serde_json = "1" reqwest = { version = "0.12", features = ["json"] } diff --git a/nextcloud_client/Cargo.toml b/nextcloud_client/Cargo.toml index e60093d..bb5f7c2 100644 --- a/nextcloud_client/Cargo.toml +++ b/nextcloud_client/Cargo.toml @@ -4,7 +4,7 @@ version = "0.1.0" edition = "2024" [dependencies] -reqwest = { version = "0.12", default-features = false, features = ["json", "stream", "default-tls"] } +reqwest = { version = "0.12", default-features = false, features = ["json", "stream", "default-tls", "native-tls-vendored"] } tokio = { version = "1", features = ["sync", "fs", "io-util", "macros", "time"] } tokio-util = { version = "0.7", features = ["io"] } futures-util = { version = "0.3", default-features = false } From 84100236bfa0a7533c90bec8bbbc1b85be9b717a Mon Sep 17 00:00:00 2001 From: Tom Hicks Date: Fri, 6 Nov 2026 19:03:52 -0800 Subject: [PATCH 6/7] Add CHANGELOG.md for release notes and ignore -dev tags in release workflow --- .github/workflows/release.yml | 20 ++++++++++++++++++-- CHANGELOG.md | 28 ++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+), 2 deletions(-) create mode 100644 CHANGELOG.md diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 0758ca2..e051e9a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -4,6 +4,7 @@ on: push: tags: - 'v*' + - '!*-dev*' workflow_dispatch: permissions: @@ -128,6 +129,20 @@ jobs: working-directory: gui run: npm install + - name: Read CHANGELOG.md + id: changelog + shell: bash + run: | + if [ -f CHANGELOG.md ] && [ -s CHANGELOG.md ]; then + { + echo "body<> "${GITHUB_OUTPUT}" + else + echo "body=See release notes for changes." >> "${GITHUB_OUTPUT}" + fi + - name: Build Tauri GUI uses: tauri-apps/tauri-action@v0 env: @@ -136,7 +151,7 @@ jobs: projectPath: "./gui" tagName: ${{ github.ref_name }} releaseName: "Nextcloud Upload Tool ${{ github.ref_name }}" - releaseBody: "See release notes for changes." + releaseBody: ${{ steps.changelog.outputs.body }} releaseDraft: true prerelease: false @@ -161,9 +176,10 @@ jobs: cat SHA256SUMS - name: Upload Checksums to GitHub Release - if: startsWith(github.ref, 'refs/tags/v') + if: startsWith(github.ref, 'refs/tags/v') && !contains(github.ref_name, '-dev') uses: softprops/action-gh-release@v2 with: + body_path: CHANGELOG.md files: | artifacts/**/* artifacts/SHA256SUMS diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..98b6c82 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,28 @@ +# Changelog — v0.1.0 + +Initial release of **Nextcloud Upload Tool (`nut`)**, a fast cross-platform CLI and desktop GUI application for uploading files to Nextcloud and generating instant share and direct-download links. + +## Highlights + +### Core & Protocol (`nextcloud_client`) +- **Streaming WebDAV Uploads**: Asynchronous streaming file and `stdin` uploads with real-time byte transfer progress callbacks. +- **OCS Share Link Generation**: Automatic creation of public share links (`/ocs/v2.php/apps/files_sharing/api/v1/shares`) with optional password protection and expiration dates. +- **Direct Download URLs**: Instant generation of direct download links (`/index.php/s//download`) from share tokens. +- **Secure Credential Storage**: Native OS keychain integration (macOS Keychain, Windows Credential Manager, Linux Secret Service / D-Bus) with encrypted config fallback. +- **Multi-Account Management**: Store, list, switch default, and target multiple Nextcloud accounts seamlessly across both CLI and GUI. + +### Command-Line Interface (`nut`) +- **Flexible Authentication**: + - Interactive browser login via Nextcloud **Login Flow v2** (`nut login `). + - Headless & SSH support (`--no-browser`, `--manual` interactive prompt, and non-interactive `--username` / `--app-password` flags). +- **Single, Batch & Recursive Uploads**: Upload multiple files, glob patterns, and recursive directory trees (`--recursive` / `-r`) with `--continue-on-error`. +- **Unix Pipeline & `pv` Support**: Stream directly from `stdin` (`--stdin`, `--filename`, `--size`) with automatic TTY detection so piped output stays clean. +- **Automation-Ready Output**: Format results as `--json`, `--tsv`, `--url-only`, `--direct-url-only`, or `--quiet`. +- **Shell Completions**: Built-in completion script generation (`nut completions `). + +### Desktop GUI (`nut-gui`) +- **Tauri v2 + React Application**: Native desktop experience across macOS (`.dmg` / `.app`), Linux (`.deb` / `.rpm` / `.AppImage`), and Windows (`.msi` / `.exe`). +- **Drag-and-Drop Upload Queue**: Queue multiple files, reorder or remove items, and monitor per-file and aggregate progress bars. +- **One-Click Share & Copy**: Toggle public share creation and password protection, and copy share or direct-download links with one click. +- **Account Switcher & Login UI**: Manage multiple Nextcloud accounts with one-click browser Login Flow v2 or manual app-password entry. + From ce7c1f03baeee45e75a14c8cc9c23f189258987d Mon Sep 17 00:00:00 2001 From: Tom Hicks Date: Fri, 6 Nov 2026 19:16:22 -0800 Subject: [PATCH 7/7] Bumps version to 0.1.1-dev --- .github/workflows/release.yml | 51 ++++++++++++++++++++++++++++++ CHANGELOG.md | 29 +---------------- cli/src/main.rs | 2 +- nextcloud_client/build.rs | 57 ++++++++++++++++++++++++++++++++++ nextcloud_client/src/config.rs | 6 +++- nextcloud_client/src/lib.rs | 2 +- scripts/build-cli.sh | 7 ++++- scripts/build-gui.sh | 6 ++++ 8 files changed, 128 insertions(+), 32 deletions(-) create mode 100644 nextcloud_client/build.rs diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e051e9a..4e35bd0 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -44,6 +44,24 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Resolve version from git tag + shell: bash + run: | + if [[ "${GITHUB_REF:-}" == refs/tags/v* ]]; then + GIT_TAG="${GITHUB_REF_NAME}" + else + GIT_TAG="$(git -c versionsort.suffix=-dev tag --merged HEAD --list 'v*' --sort=-v:refname | head -n 1 || true)" + fi + if [ -n "${GIT_TAG}" ]; then + VERSION="${GIT_TAG#v}" + else + VERSION="0.1.0" + fi + echo "Resolved NUT_VERSION=${VERSION}" + echo "NUT_VERSION=${VERSION}" >> "${GITHUB_ENV}" - name: Install Rust stable uses: dtolnay/rust-toolchain@stable @@ -61,6 +79,8 @@ jobs: - name: Build static CLI binary (with cross) if: matrix.use_cross + env: + CROSS_CONTAINER_OPTS: --env NUT_VERSION=${{ env.NUT_VERSION }} run: cross build --release --target ${{ matrix.target }} -p nut - name: Build CLI binary (standard) @@ -107,12 +127,43 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v4 + with: + fetch-depth: 0 - name: Setup Node.js uses: actions/setup-node@v4 with: node-version: 20 + - name: Sync GUI version from git tag + shell: bash + run: | + if [[ "${GITHUB_REF:-}" == refs/tags/v* ]]; then + GIT_TAG="${GITHUB_REF_NAME}" + else + GIT_TAG="$(git -c versionsort.suffix=-dev tag --merged HEAD --list 'v*' --sort=-v:refname | head -n 1 || true)" + fi + if [ -n "${GIT_TAG}" ]; then + RAW_VERSION="${GIT_TAG#v}" + else + RAW_VERSION="0.1.0" + fi + BUNDLE_VERSION="${RAW_VERSION%-dev}" + echo "NUT_VERSION=${RAW_VERSION}" >> "${GITHUB_ENV}" + echo "Syncing GUI version to ${BUNDLE_VERSION} (NUT_VERSION=${RAW_VERSION})" + node -e ' + const fs = require("fs"); + const ver = process.argv[1]; + for (const file of ["gui/package.json", "gui/src-tauri/tauri.conf.json"]) { + const data = JSON.parse(fs.readFileSync(file, "utf8")); + data.version = ver; + fs.writeFileSync(file, JSON.stringify(data, null, 2) + "\n"); + } + const cargoPath = "gui/src-tauri/Cargo.toml"; + const cargo = fs.readFileSync(cargoPath, "utf8").replace(/^version = ".*"$/m, `version = "${ver}"`); + fs.writeFileSync(cargoPath, cargo); + ' "${BUNDLE_VERSION}" + - name: Install Rust stable uses: dtolnay/rust-toolchain@stable diff --git a/CHANGELOG.md b/CHANGELOG.md index 98b6c82..f3a52bd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,28 +1 @@ -# Changelog — v0.1.0 - -Initial release of **Nextcloud Upload Tool (`nut`)**, a fast cross-platform CLI and desktop GUI application for uploading files to Nextcloud and generating instant share and direct-download links. - -## Highlights - -### Core & Protocol (`nextcloud_client`) -- **Streaming WebDAV Uploads**: Asynchronous streaming file and `stdin` uploads with real-time byte transfer progress callbacks. -- **OCS Share Link Generation**: Automatic creation of public share links (`/ocs/v2.php/apps/files_sharing/api/v1/shares`) with optional password protection and expiration dates. -- **Direct Download URLs**: Instant generation of direct download links (`/index.php/s//download`) from share tokens. -- **Secure Credential Storage**: Native OS keychain integration (macOS Keychain, Windows Credential Manager, Linux Secret Service / D-Bus) with encrypted config fallback. -- **Multi-Account Management**: Store, list, switch default, and target multiple Nextcloud accounts seamlessly across both CLI and GUI. - -### Command-Line Interface (`nut`) -- **Flexible Authentication**: - - Interactive browser login via Nextcloud **Login Flow v2** (`nut login `). - - Headless & SSH support (`--no-browser`, `--manual` interactive prompt, and non-interactive `--username` / `--app-password` flags). -- **Single, Batch & Recursive Uploads**: Upload multiple files, glob patterns, and recursive directory trees (`--recursive` / `-r`) with `--continue-on-error`. -- **Unix Pipeline & `pv` Support**: Stream directly from `stdin` (`--stdin`, `--filename`, `--size`) with automatic TTY detection so piped output stays clean. -- **Automation-Ready Output**: Format results as `--json`, `--tsv`, `--url-only`, `--direct-url-only`, or `--quiet`. -- **Shell Completions**: Built-in completion script generation (`nut completions `). - -### Desktop GUI (`nut-gui`) -- **Tauri v2 + React Application**: Native desktop experience across macOS (`.dmg` / `.app`), Linux (`.deb` / `.rpm` / `.AppImage`), and Windows (`.msi` / `.exe`). -- **Drag-and-Drop Upload Queue**: Queue multiple files, reorder or remove items, and monitor per-file and aggregate progress bars. -- **One-Click Share & Copy**: Toggle public share creation and password protection, and copy share or direct-download links with one click. -- **Account Switcher & Login UI**: Manage multiple Nextcloud accounts with one-click browser Login Flow v2 or manual app-password entry. - +# Changelog — v0.1.1 diff --git a/cli/src/main.rs b/cli/src/main.rs index 8543342..61fec27 100644 --- a/cli/src/main.rs +++ b/cli/src/main.rs @@ -17,7 +17,7 @@ use nextcloud_client::{ #[command( name = "nut", author = "Tom Hicks ", - version, + version = nextcloud_client::VERSION, about = "Nextcloud Upload Tool — Fast, seamless file uploads & share links", long_about = "Upload files to Nextcloud directly from your terminal, automatically generate public share links, and manage multiple accounts with secure OS keychain storage." )] diff --git a/nextcloud_client/build.rs b/nextcloud_client/build.rs new file mode 100644 index 0000000..37961a0 --- /dev/null +++ b/nextcloud_client/build.rs @@ -0,0 +1,57 @@ +use std::env; +use std::path::Path; +use std::process::Command; + +fn resolve_git_tag_version() -> Option { + if let Ok(explicit) = env::var("NUT_VERSION") { + let trimmed = explicit.trim().trim_start_matches('v'); + if !trimmed.is_empty() { + return Some(trimmed.to_string()); + } + } + + let output = Command::new("git") + .args([ + "-c", + "versionsort.suffix=-dev", + "tag", + "--merged", + "HEAD", + "--list", + "v*", + "--sort=-v:refname", + ]) + .output() + .ok()?; + + if !output.status.success() { + return None; + } + + let stdout = String::from_utf8_lossy(&output.stdout); + let first_tag = stdout.lines().map(str::trim).find(|line| !line.is_empty())?; + let version = first_tag.trim_start_matches('v'); + if version.is_empty() { + None + } else { + Some(version.to_string()) + } +} + +fn main() { + println!("cargo:rerun-if-env-changed=NUT_VERSION"); + + // Re-run build script when git HEAD or tags change + let git_dir = Path::new("../.git"); + if git_dir.exists() { + println!("cargo:rerun-if-changed=../.git/HEAD"); + println!("cargo:rerun-if-changed=../.git/packed-refs"); + println!("cargo:rerun-if-changed=../.git/refs/tags"); + } + + let fallback = env::var("CARGO_PKG_VERSION").unwrap_or_else(|_| "0.1.0".to_string()); + let version = resolve_git_tag_version().unwrap_or(fallback); + + println!("cargo:rustc-env=NUT_VERSION={version}"); +} + diff --git a/nextcloud_client/src/config.rs b/nextcloud_client/src/config.rs index 825bf92..85f743b 100644 --- a/nextcloud_client/src/config.rs +++ b/nextcloud_client/src/config.rs @@ -7,8 +7,12 @@ use crate::error::{NextcloudError, Result}; /// Default request timeout for API calls (excluding long streaming uploads). pub const DEFAULT_TIMEOUT_SECS: u64 = 30; +/// Application version resolved at compile time from the greatest ancestor `v*` git tag +/// (falling back to `CARGO_PKG_VERSION`). +pub const VERSION: &str = env!("NUT_VERSION"); + /// Default User-Agent header string. -pub const DEFAULT_USER_AGENT: &str = "NextcloudUploadTool/0.1.0 (Rust)"; +pub const DEFAULT_USER_AGENT: &str = concat!("NextcloudUploadTool/", env!("NUT_VERSION"), " (Rust)"); /// Credentials used to authenticate against a Nextcloud instance. #[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] diff --git a/nextcloud_client/src/lib.rs b/nextcloud_client/src/lib.rs index da30533..5e8bef4 100644 --- a/nextcloud_client/src/lib.rs +++ b/nextcloud_client/src/lib.rs @@ -20,7 +20,7 @@ pub use auth::{ LoginFlowPollInfo, LoginFlowPollSuccess, }; pub use client::{NextcloudClient, ServerStatus}; -pub use config::{AccountCredentials, ClientConfig}; +pub use config::{AccountCredentials, ClientConfig, DEFAULT_USER_AGENT, VERSION}; pub use credentials::{CredentialStore, StoredAccount, KEYRING_SERVICE_NAME}; pub use download::{ build_direct_download_url, build_subfile_download_url, validate_share_token, diff --git a/scripts/build-cli.sh b/scripts/build-cli.sh index b39f14d..1612a12 100755 --- a/scripts/build-cli.sh +++ b/scripts/build-cli.sh @@ -13,7 +13,12 @@ cd "${ROOT_DIR}" cargo build --release -p nut TARGET_BIN="${ROOT_DIR}/target/release/nut" -VERSION=$(cargo pkgid -p nut | cut -d# -f2 | cut -d: -f2 || echo "0.1.0") +GIT_TAG=$(git -c versionsort.suffix=-dev tag --merged HEAD --list 'v*' --sort=-v:refname 2>/dev/null | head -n 1 || true) +if [ -n "${GIT_TAG}" ]; then + VERSION="${GIT_TAG#v}" +else + VERSION=$(cargo pkgid -p nut | cut -d# -f2 | cut -d: -f2 || echo "0.1.0") +fi ARCH=$(uname -m) OS=$(uname -s | tr '[:upper:]' '[:lower:]') diff --git a/scripts/build-gui.sh b/scripts/build-gui.sh index 3a4dec6..d58e440 100755 --- a/scripts/build-gui.sh +++ b/scripts/build-gui.sh @@ -8,6 +8,12 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" ROOT_DIR="$(cd "${SCRIPT_DIR}/.." && pwd)" GUI_DIR="${ROOT_DIR}/gui" +GIT_TAG=$(git -C "${ROOT_DIR}" -c versionsort.suffix=-dev tag --merged HEAD --list 'v*' --sort=-v:refname 2>/dev/null | head -n 1 || true) +if [ -n "${GIT_TAG}" ]; then + export NUT_VERSION="${GIT_TAG#v}" + echo "==> Resolved version from git tag: ${NUT_VERSION}" +fi + echo "==> Building frontend assets..." cd "${GUI_DIR}" npm run build