@@ -64,19 +64,24 @@ jobs:
6464 cp "./crate_universe/target/release/$BIN_NAME" "${NAME}/"
6565
6666 cat > "${NAME}/BUILD" <<EOF
67- filegroup(
68- name = "cargo-bazel",
69- srcs = ["${BIN_NAME}"],
70- visibility = ["//visibility:public"],
67+ exports_files(["${BIN_NAME}"])
68+
69+ load("@rules_shell//shell:sh_binary.bzl", "sh_binary")
70+
71+ sh_binary(
72+ name = "bin",
73+ srcs = ["${BIN_NAME}"],
74+ visibility = ["//visibility:public"],
7175 )
76+
7277 EOF
7378
7479 tar -cf - "${NAME}" | zstd --ultra -22 -o "artifacts-archive/$NAME.tar.zst"
7580
7681 - name : Upload artifact
7782 uses : actions/upload-artifact@v4
7883 with :
79- name : ${{ env.NAME }}.tar.zst
84+ name : ${{ env.NAME }}
8085 path : artifacts-archive/${{ env.NAME }}.tar.zst
8186
8287 release :
@@ -92,28 +97,35 @@ jobs:
9297
9398 - name : Generate release body
9499 run : |
95- echo 'http_archive = use_repo_rule("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")' > release_body.txt
100+ set -euo pipefail
101+
102+ shopt -s globstar # enable recursive globbing
103+
104+ echo "```" > release_body.txt
105+ echo 'http_archive = use_repo_rule("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")' >> release_body.txt
106+ echo "" >> release_body.txt
107+
108+ echo 'cargo_bazel_url = ""https://github.com/${{ github.repository }}/releases/download/commit-${{ github.sha }}/"' >> release_body.txt
96109 echo "" >> release_body.txt
97110
98- for archive in ./artifacts/*.tar.zst; do
111+ for archive in ./artifacts/**/* .tar.zst; do
99112 FILE_NAME=$(basename "$archive")
100113 SHA=$(sha256sum "$archive" | awk '{print $1}')
101114 NAME="${FILE_NAME%.tar.zst}"
102- URL="https://github.com/${{ github.repository }}/releases/download/commit-${{ github.sha }}/$FILE_NAME"
103- STRIP_PREFIX="$NAME"
104115
105116 cat >> release_body.txt <<EOF
106117 http_archive(
107118 name = "$NAME",
108119 sha256 = "$SHA",
109- strip_prefix = "$STRIP_PREFIX ",
110- url = "$URL ",
120+ strip_prefix = "$NAME ",
121+ url = cargo_bazel_url + "$FILE_NAME ",
111122 )
112123 EOF
113124
114125 echo "" >> release_body.txt
115126 done
116127
128+ echo "```" >> release_body.txt
117129 cat release_body.txt
118130
119131 - name : Create GitHub Release
@@ -122,6 +134,6 @@ jobs:
122134 tag_name : commit-${{ github.sha }}
123135 name : " cargo-bazel build for ${{ github.sha }}"
124136 body_path : release_body.txt
125- files : ./artifacts/*.tar.zst
137+ files : ./artifacts/**/* .tar.zst
126138 env :
127139 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
0 commit comments