File tree Expand file tree Collapse file tree 2 files changed +17
-11
lines changed Expand file tree Collapse file tree 2 files changed +17
-11
lines changed Original file line number Diff line number Diff line change 23
23
steps :
24
24
- name : Checkout source code
25
25
uses : actions/checkout@v4
26
+ - name : Get tags
27
+ run : git fetch --tags origin
26
28
- name : Configure build cache
27
29
uses : actions/cache@v4
28
30
with :
59
61
- x86_64-apple-darwin
60
62
steps :
61
63
- uses : actions/checkout@v4
64
+ - name : Get tags
65
+ run : git fetch --tags origin
62
66
- name : Configure build cache
63
67
uses : actions/cache@v4
64
68
with :
Original file line number Diff line number Diff line change @@ -50,22 +50,24 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
50
50
// If `HEAD` doesn't have a tag pointing to it, this is a development version,
51
51
// so find the closest tag starting with `v` and append `-dev` to the version.
52
52
// Eg. "1.0.43-dev".
53
- Command :: new ( "git" )
53
+ let output = Command :: new ( "git" )
54
54
. arg ( "describe" )
55
55
. arg ( "--match=v*" ) // Match tags starting with `v`
56
56
. arg ( "--candidates=1" ) // Only one result
57
57
. arg ( "--abbrev=0" ) // Don't add the commit short-hash to the tag name
58
58
. arg ( "HEAD" )
59
- . output ( )
60
- . ok ( )
61
- . and_then ( |output| {
62
- if output. status . success ( ) {
63
- String :: from_utf8 ( output. stdout ) . ok ( )
64
- } else {
65
- None
66
- }
67
- } )
68
- . map ( |last| format ! ( "{}-dev" , last. trim( ) ) )
59
+ . output ( ) ?;
60
+ if output. status . success ( ) {
61
+ String :: from_utf8 ( output. stdout )
62
+ . ok ( )
63
+ . map ( |last| format ! ( "{}-dev" , last. trim( ) ) )
64
+ } else {
65
+ println ! (
66
+ "cargo::warn=error:{}" ,
67
+ String :: from_utf8_lossy( & output. stderr)
68
+ ) ;
69
+ None
70
+ }
69
71
}
70
72
// If there are no tags found, we'll just call this a pre-release.
71
73
. unwrap_or ( String :: from ( "pre-release" ) ) ;
You can’t perform that action at this time.
0 commit comments