ci, fix: re-add get_version.sh
ci/woodpecker/push/woodpecker Pipeline failed Details

Obviously, we don't push the .git repo directory inside the build containers, so the build has no way of telling the version.  But it's nice we got it working.
feat/type-attributes
Tomáš Mládek 2023-08-23 18:57:11 +02:00
parent a8f5c08f4b
commit 77eccc5bb6
6 changed files with 19 additions and 74 deletions

64
Cargo.lock generated
View File

@ -703,12 +703,6 @@ version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7"
[[package]]
name = "const_fn"
version = "0.4.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fbdcdcb6d86f71c5e97409ad45898af11cbc995b4ee8112d59095a28d376c935"
[[package]]
name = "const_format"
version = "0.2.30"
@ -1265,19 +1259,6 @@ dependencies = [
"weezl",
]
[[package]]
name = "git2"
version = "0.17.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7b989d6a7ca95a362cf2cfc5ad688b3a467be1f87e480b8dad07fee8c79b0044"
dependencies = [
"bitflags 1.3.2",
"libc",
"libgit2-sys",
"log",
"url",
]
[[package]]
name = "h2"
version = "0.3.18"
@ -1668,18 +1649,6 @@ version = "0.2.144"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2b00cc1c228a6782d0f076e7b232802e0c5689d41bb5df366f2a6b6621cfdfe1"
[[package]]
name = "libgit2-sys"
version = "0.15.2+1.6.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a80df2e11fb4a61f4ba2ab42dbe7f74468da143f1a75c74e11dee7c813f694fa"
dependencies = [
"cc",
"libc",
"libz-sys",
"pkg-config",
]
[[package]]
name = "libsqlite3-sys"
version = "0.22.2"
@ -1700,18 +1669,6 @@ dependencies = [
"cc",
]
[[package]]
name = "libz-sys"
version = "1.1.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d97137b25e321a73eef1418d1d5d2eda4d77e12813f8e6dead84bc52c5870a7b"
dependencies = [
"cc",
"libc",
"pkg-config",
"vcpkg",
]
[[package]]
name = "link-cplusplus"
version = "1.0.8"
@ -2785,10 +2742,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "970538704756fd0bb4ec8cb89f80674afb661e7c0fe716f9ba5be57717742300"
dependencies = [
"const_format",
"git2",
"is_debug",
"time 0.3.20",
"tzdb",
]
[[package]]
@ -3216,25 +3171,6 @@ version = "1.16.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba"
[[package]]
name = "tz-rs"
version = "0.6.14"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "33851b15c848fad2cf4b105c6bb66eb9512b6f6c44a4b13f57c53c73c707e2b4"
dependencies = [
"const_fn",
]
[[package]]
name = "tzdb"
version = "0.5.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ec758958f2fb5069cd7fae385be95cc8eceb8cdfd270c7d14de6034f0108d99e"
dependencies = [
"iana-time-zone",
"tz-rs",
]
[[package]]
name = "unicase"
version = "2.6.0"

View File

@ -34,7 +34,8 @@ docker:
upend-bin:
FROM +base-rust
RUN cargo build --release
COPY +git-version/version.txt .
RUN UPEND_VERSION=$(cat version.txt) cargo build --release
SAVE ARTIFACT target/release/upend upend
webui:
@ -112,6 +113,12 @@ deploy-appimage-nightly:
chmod 600 $HOME/.ssh/*
RUN scp -v *.AppImage *.asc mainsite:releases/nightly
git-version:
LOCALLY
RUN ./build/get_version.sh | tee /tmp/upend_version.txt
SAVE ARTIFACT /tmp/upend_version.txt version.txt
RUN rm /tmp/upend_version.txt
base-rust:
FROM rust:bookworm
RUN rustup component add clippy

9
build/get_version.sh Executable file
View File

@ -0,0 +1,9 @@
#!/bin/sh
git_tag=$(git describe --tags --exact-match HEAD 2>/dev/null)
if [ -z "$git_tag" ]; then
echo "dev_$(git rev-parse --short HEAD)"
else
echo "$git_tag" | sed -e 's/^v//g'
fi

View File

@ -91,7 +91,7 @@ bytes = "1.4.0"
signal-hook = "0.3.15"
[build-dependencies]
shadow-rs = { version = "0.23" }
shadow-rs = { version = "0.23", default-features = false }
[features]
default = [

View File

@ -1,4 +1,3 @@
fn main() -> shadow_rs::SdResult<()> {
println!("cargo:rustc-env=GIT_TAG={}", shadow_rs::tag());
shadow_rs::new()
}

View File

@ -179,13 +179,7 @@ struct ServeArgs {
#[actix_web::main]
async fn main() -> Result<()> {
let upend_version = if env!("GIT_TAG").is_empty() {
format!("dev-{}", common::build::SHORT_COMMIT)
} else {
env!("GIT_TAG")[1..].to_string() // Remove the leading 'v'
};
let command = Cli::command().version(upend_version);
let command = Cli::command().version(option_env!("UPEND_VERSION").unwrap_or("unknown"));
let args = Cli::from_arg_matches(&command.get_matches())?;
tracing_subscriber::fmt()