#!/usr/bin/env bash # Write the release version (artifacts/version.txt) into Cargo.toml/Cargo.lock # before building, so the .deb/.pkg/.exe carry the same version as the tag. set -euo pipefail cd "$(dirname "$0")/../.." v="$(cat artifacts/version.txt)" sed -i "0,/^version = .*/s//version = \"$v\"/" Cargo.toml awk -v v="$v" 'p&&/^version = /{print "version = \"" v "\"";p=0;next} /^name = "posprint"$/{p=1} {print}' Cargo.lock > Cargo.lock.new && mv Cargo.lock.new Cargo.lock echo "Version: $v"