add auto-updater and git workflow enhancements
publish / publish-tauri (, windows-latest) (release) Failing after 2m52s

This change introduces a comprehensive auto-update mechanism for the application and significant improvements to the integrated Git client experience.

Key features include:
- **Automated Release Workflow:** A new Gitea Actions workflow (`app_builder.yaml`) and a Python `cicd_tool` are added to automatically build, sign, and upload release artifacts to S3-compatible storage (MinIO) upon a new release. This also generates the `latest.json` file required by the updater.
- **Tauri Updater Integration:** The `tauri-plugin-updater` is integrated into the application, enabling it to check for and apply updates seamlessly.
- **Robust Git Push Handling:** The application now intelligently handles non-fast-forward push failures by prompting the user to perform a pull/merge operation before re-attempting the push.
- **Enhanced File Comparison:** A new `compare_file_to_parent` command is introduced, allowing detailed file diffs against a commit's direct parent, including the "empty tree" for initial commits.
- **Explorer Panel Improvements:** "Expand All" and "Collapse All" functionality is added to the file explorer for better navigation.
This commit is contained in:
Christoph Brandau
2026-06-30 13:23:30 +02:00
parent 4aa9a537f0
commit 58bd246221
19 changed files with 1283 additions and 37 deletions
+134
View File
@@ -0,0 +1,134 @@
name: "publish"
on:
release:
types: [published]
jobs:
publish-tauri:
permissions:
contents: write
environment: production
env:
# --- Gitea (unchanged) ---
GITEA_API: https://git.cbsk-tech.de/api/v1
OWNER: Christoph
REPO: GitLite
GITEA_TOKEN: ${{ secrets.ACTIONS_TOKEN }}
GITEA_FALLBACK_TOKEN: ${{ github.token }}
# --- MinIO / S3-compatible upload ---
MINIO_ENDPOINT: ${{ vars.MINIO_ENDPOINT }} # e.g. https://updates.example.com
S3_BUCKET: ${{ vars.S3_BUCKET }} # e.g. updates
AWS_ACCESS_KEY_ID: ${{ secrets.S3_ACCESS_KEY }} # used by aws cli
AWS_SECRET_ACCESS_KEY: ${{ secrets.S3_SECRET_KEY }} # used by aws cli
ARTIFACT_BASE_URL: ${{ vars.ARTIFACT_BASE_URL }} # e.g. https://updates.example.com
S3_ACCESS_KEY: ${{ secrets.S3_ACCESS_KEY }} # used by cicd_tool
S3_SECRET_KEY: ${{ secrets.S3_SECRET_KEY }} # used by cicd_tool
defaults:
run:
working-directory: GitLite
strategy:
fail-fast: false
matrix:
include:
# - platform: 'macos-latest'
# args: '--target aarch64-apple-darwin'
# - platform: 'macos-latest'
# args: '--target x86_64-apple-darwin'
# - platform: 'ubuntu-22.04'
# args: ''
- platform: "windows-latest"
args: ""
runs-on: ${{ matrix.platform }}
steps:
# cicd_tool/main.py expects the repo at <workspace>/GitLite, so check out there.
- uses: actions/checkout@v5
with:
path: GitLite
- name: install dependencies (ubuntu only)
if: matrix.platform == 'ubuntu-22.04'
run: |
sudo apt-get update
sudo apt-get install -y libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf
- name: setup node
uses: actions/setup-node@v4
with:
node-version: lts/*
- name: install frontend dependencies
run: npm ci
- name: Update package.json Version
run: npm version ${{ github.ref_name }} --no-git-tag-version --allow-same-version
- name: Update tauri.conf.json Version
shell: pwsh
run: |
$path = ".\src-tauri\tauri.conf.json"
$version = '${{ github.ref_name }}'
$content = Get-Content -Raw -Encoding UTF8 $path
$regex = [regex]'"version"\s*:\s*"[^"]*"'
$replacement = '"version": "' + $version + '"'
$updated = $regex.Replace($content, $replacement, 1)
$encoding = New-Object System.Text.UTF8Encoding($false)
[System.IO.File]::WriteAllText($path, $updated, $encoding)
- name: Commit and Push Changes
shell: pwsh
run: |
git config user.name '${{ vars.USERNAME_GIT }}'
git config user.email '${{ vars.EMAIL_GIT }}'
git add package.json src-tauri/tauri.conf.json
git commit -m 'Update version to ${{ github.ref_name }}'
if ($LASTEXITCODE -ne 0) {
Write-Host 'No changes to commit.'
}
# Get current branch; if detached, resolve to a remote branch that contains this commit
$branch = (git rev-parse --abbrev-ref HEAD).Trim()
if ($branch -eq 'HEAD' -or [string]::IsNullOrEmpty($branch)) {
# If target_commitish is a branch, use it; if it's a SHA, find a branch that contains it
$candidate = '${{ github.event.release.target_commitish }}'
if ($candidate -match '^[0-9a-f]{40}$') {
$branch = (
git branch -r --contains $env:GITHUB_SHA |
ForEach-Object { $_.Trim() } |
Where-Object { $_ -and ($_ -notmatch '->') } |
ForEach-Object { $_ -replace '^(?:remotes/)?[^/]+/', '' } |
Select-Object -First 1
)
} else {
$branch = $candidate
}
}
if ([string]::IsNullOrEmpty($branch)) {
Write-Host 'Could not determine branch for push.'
git branch -a
exit 1
}
git push origin "HEAD:refs/heads/$branch"
- name: Build Tauri App
env:
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }}
TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD}}
run: npm run tauri build
# ----------------------
# Upload to MinIO (via mc) and create latest.json
# ----------------------
- name: Upload artifacts to MinIO with cicd_tool
working-directory: GitLite/cicd_tool
run: |
pip install uv
uv sync
uv run main.py