File: publish.sh

package info (click to toggle)
rustc 1.85.0%2Bdfsg3-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental, sid, trixie
  • size: 893,396 kB
  • sloc: xml: 158,127; python: 35,830; javascript: 19,497; cpp: 19,002; sh: 17,245; ansic: 13,127; asm: 4,376; makefile: 1,051; perl: 29; lisp: 29; ruby: 19; sql: 11
file content (46 lines) | stat: -rwxr-xr-x 1,132 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/bin/bash

set -e

function publish {
    publish_this="$1"
    crate_name="$2"
    manifest="$3"

    if [ "$publish_this" != "true" ]
    then
        echo "Skipping $crate_name, publish not requested."
        return
    fi

    # Get the version from Cargo.toml
    version=`sed -n -E 's/^version = "(.*)"/\1/p' $manifest`

    # Check crates.io if it is already published
    set +e
    output=`curl --fail --silent --head --location https://static.crates.io/crates/$crate_name/$version/download`
    res="$?"
    set -e
    case $res in
        0)
            echo "${crate_name}@${version} appears to already be published"
            return
            ;;
        22) ;;
        *)
            echo "Failed to check ${crate_name}@${version} res: $res"
            echo "$output"
            exit 1
            ;;
    esac

    cargo publish --manifest-path $manifest --no-verify

    tag="${crate_name}-${version}"
    git tag $tag
    git push origin "$tag"
}

publish $PUBLISH_LIBGIT2_SYS libgit2-sys libgit2-sys/Cargo.toml
publish $PUBLISH_GIT2 git2 Cargo.toml
publish $PUBLISH_GIT2_CURL git2-curl git2-curl/Cargo.toml