File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 4343 - name : Build static release
4444 env :
4545 CARGO_TARGET_DIR : target-cross
46+ STACKDOG_GIT_HASH : ${{ github.sha }}
4647 run : cross build --release --target x86_64-unknown-linux-musl
4748
4849 - name : Build frontend
9899 with :
99100 context : .
100101 push : true
101- tags : trydirect/stackdog:latest
102+ tags : |
103+ vsilent/stackdog:latest
104+ vsilent/stackdog:${{ github.sha }}
Original file line number Diff line number Diff line change 11use std:: process:: Command ;
22
33fn main ( ) {
4- let hash = Command :: new ( "git" )
5- . args ( [ "rev-parse" , "--short" , "HEAD" ] )
6- . output ( )
7- . ok ( )
8- . filter ( |o| o. status . success ( ) )
9- . and_then ( |o| String :: from_utf8 ( o. stdout ) . ok ( ) )
10- . map ( |s| s. trim ( ) . to_string ( ) )
11- . unwrap_or_else ( || "unknown" . to_string ( ) ) ;
4+ // Allow CI (or any build environment) to inject the hash directly.
5+ // Falls back to running `git rev-parse --short HEAD` locally.
6+ let hash = std:: env:: var ( "STACKDOG_GIT_HASH" ) . unwrap_or_else ( |_| {
7+ Command :: new ( "git" )
8+ . args ( [ "rev-parse" , "--short" , "HEAD" ] )
9+ . output ( )
10+ . ok ( )
11+ . filter ( |o| o. status . success ( ) )
12+ . and_then ( |o| String :: from_utf8 ( o. stdout ) . ok ( ) )
13+ . map ( |s| s. trim ( ) . to_string ( ) )
14+ . unwrap_or_else ( || "unknown" . to_string ( ) )
15+ } ) ;
1216
1317 println ! ( "cargo:rustc-env=STACKDOG_GIT_HASH={hash}" ) ;
1418 println ! ( "cargo:rerun-if-changed=.git/HEAD" ) ;
You can’t perform that action at this time.
0 commit comments