#!/usr/bin/env bash # Exit on error set -e RUST_TARGETS=( "x86_64-unknown-linux-gnu" #"i686-unknown-linux-gnu" #"x86_64-unknown-linux-musl" #"i686-unknown-linux-musl" #"x86_64-apple-darwin" #"aarch64-apple-darwin" #"x86_64-pc-windows-gnu" #"i686-pc-windows-gnu" ) # shellcheck source=./bin/common.lib.sh source "$(dirname "$0")"/bin/common.lib.sh # shellcheck source=./bin/rust.lib.sh source "$(dirname "$0")"/bin/rust.lib.sh function check-desktop-file() { bin/generate-desktop-file.sh >/tmp/exif-cleaner-gui.desktop diff {resources,/tmp}/exif-cleaner-gui.desktop } function debian-build() { local targets version crate_name target targets=$1 version=$(crate-version) crate_name=$(crate-name) for target in $targets; do local path path=$(cargo deb --target="$target") cp -v "$path" target/release/ done } # Publishes documentation/whatever to GitHub/GitLab/Gitea/Forgejo pages function pages-publish() { local base_site_dir commit_message old_branch base_site_dir=$1 commit_message=$2 old_branch=$(git-current-branch) if [[ $base_site_dir -eq "" ]]; then echo "Please specify the root path of what you want to upload" return 1 fi if [[ $repository -eq "" ]]; then echo "Please specify the repository name when calling pages-publish" return 1 fi cp -rv "$base_site_dir" "/tmp/$base_site_dir" git switch pages cp -r "/tmp/$base_site_dir" . git add . if [[ $commit_message == "" ]]; then commit_message="Update online documentation" fi git commit -m "$commit_message" git push -u origin pages git switch "$old_branch" } if [[ "$(git-current-branch)" != "main" ]]; then echo "ERROR: please run this script on the \`main\` branch" exit 1 fi # Common checks, such as clippy, doc & test cargo-checks # Find unused dependencies and panic if there are any cargo machete # If we are a library, attempt to determine if changes necessitate a major version bump or not #cargo semver-checks check-release --all-features # make sure these build before releasing check-desktop-file cargo deb cargo aur # Release cargo smart-release --execute --update-crates-index # push the good stuff git push # now, build packages with the proper new version debian-build "${RUST_TARGETS[@]}" # Build the raw binaries and moves them to target/release/$bin_name.$target cargo-build-targets exif-cleaner-gui "${RUST_TARGETS[@]}" echo "All done! Now, create the release & then run bin/aur-publish.sh"