File tree 2 files changed +78
-0
lines changed
2 files changed +78
-0
lines changed Original file line number Diff line number Diff line change
1
+ on :
2
+ workflow_dispatch :
3
+ inputs :
4
+ git2 :
5
+ description : " Publish git2"
6
+ type : boolean
7
+ default : true
8
+ git2_curl :
9
+ description : " Publish git2-curl"
10
+ type : boolean
11
+ default : true
12
+ libgit2_sys :
13
+ description : " Publish libgit2-sys"
14
+ type : boolean
15
+ default : true
16
+
17
+ permissions :
18
+ contents : write
19
+
20
+ jobs :
21
+ publish :
22
+ name : Publish to crates.io
23
+ runs-on : ubuntu-latest
24
+ steps :
25
+ - uses : actions/checkout@master
26
+ - name : Publish
27
+ env :
28
+ CARGO_REGISTRY_TOKEN : ${{ secrets.CARGO_REGISTRY_TOKEN }}
29
+ PUBLISH_GIT2 : ${{ inputs.git2 }}
30
+ PUBLISH_GIT2_CURL : ${{ inputs.git2_curl }}
31
+ PUBLISH_LIBGIT2_SYS : ${{ inputs.libgit2_sys }}
32
+ run : ./ci/publish.sh
Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ set -e
4
+
5
+ function publish {
6
+ publish_this=" $1 "
7
+ crate_name=" $2 "
8
+ manifest=" $3 "
9
+
10
+ if [ " $publish_this " != " true" ]
11
+ then
12
+ echo " Skipping $crate_name , publish not requested."
13
+ return
14
+ fi
15
+
16
+ # Get the version from Cargo.toml
17
+ version=` sed -n -E ' s/^version = "(.*)"/\1/p' $manifest `
18
+
19
+ # Check crates.io if it is already published
20
+ set +e
21
+ output=` curl --fail --silent --head https://crates.io/api/v1/crates/$crate_name /$version /download`
22
+ res=" $? "
23
+ set -e
24
+ case $res in
25
+ 0)
26
+ echo " ${crate_name} @${version} appears to already be published"
27
+ return
28
+ ;;
29
+ 22) ;;
30
+ * )
31
+ echo " Failed to check ${crate_name} @${version} res: $res "
32
+ echo " $output "
33
+ exit 1
34
+ ;;
35
+ esac
36
+
37
+ # cargo publish --manifest-path $manifest --no-verify
38
+
39
+ tag=" ${crate_name} -${version} "
40
+ git tag $tag
41
+ git push origin " $tag "
42
+ }
43
+
44
+ publish $PUBLISH_GIT2 git2 Cargo.toml
45
+ publish $PUBLISH_GIT2_CURL git2-curl git2-curl/Cargo.toml
46
+ publish $PUBLISH_LIBGIT2_SYS libgit2-sys libgit2-sys/Cargo.toml
You can’t perform that action at this time.
0 commit comments