#!/usr/bin/env sh # On a tag build, the tag is the single source of truth for the app version. # # Only src-tauri/tauri.conf.json is rewritten. That is what the Tauri bundler # stamps onto the .deb/.AppImage and what `tauri android init` turns into the # Android versionName, so it is the version a user ever sees. The workspace # Cargo.toml is deliberately left alone: editing it would invalidate Cargo.lock # and break every `--locked` build in the same run, to change a number that # appears nowhere but the binary's own metadata. # # On a non-tag run this is a no-op, so it is safe to call unconditionally. # # POSIX sh: the runner's /bin/sh is dash. set -e CONF="$(dirname "$0")/../src-tauri/tauri.conf.json" case "${GITHUB_REF:-}" in refs/tags/v*) VERSION="${GITHUB_REF#refs/tags/v}" echo "Setting app version to $VERSION (from $GITHUB_REF)" sed -i "s/\"version\": \"[^\"]*\"/\"version\": \"$VERSION\"/" "$CONF" ;; *) echo "Not a tag build — keeping the version in tauri.conf.json" ;; esac grep '"version"' "$CONF"