@@ -119,20 +119,34 @@ jobs:
119119          name : " ${{ matrix.env.TARGET }}" 
120120          path : ${{ github.workspace }}/crate_universe/target/artifacts/${{ matrix.env.TARGET }} 
121121          if-no-files-found : error 
122-   release :
123-     if : startsWith(github.ref, 'refs/heads/main') 
122+   archive :
124123    needs : builds 
125124    runs-on : ubuntu-22.04 
125+     outputs :
126+       release_version : ${{ steps.version.outputs.release_version }} 
127+       archive_sha256_base64 : ${{ steps.archive.outputs.archive_sha256_base64 }} 
126128    steps :
127129      - uses : actions/checkout@v4 
128130      - uses : actions/download-artifact@v4 
129131        with :
130132          path : ${{ github.workspace }}/crate_universe/target/artifacts 
131133      - name : Detect the current version 
134+         id : version 
132135        run : | 
133136          version="$(grep 'VERSION =' ${{ github.workspace }}/version.bzl | grep -o '[[:digit:].]\+')" 
134137          echo "RELEASE_VERSION=${version}" >> $GITHUB_ENV 
138+           echo "release_version=${version}" >> $GITHUB_OUTPUT 
139+        - name : Comment out module overrides in .bazelrc files 
140+         run : | 
141+           # Find all .bazelrc files and comment out rules_rust module overrides 
142+           find . -name "*.bazelrc" -type f | while read -r file; do 
143+             if grep -q "^common --override_module=rules_rust=" "$file"; then 
144+               echo "Commenting out module override in: $file" 
145+               sed -i 's/^common --override_module=rules_rust=/# &/' "$file" 
146+             fi 
147+           done 
135148       - name : Create the rules archive 
149+         id : archive 
136150        run : | 
137151          # Update urls and sha256 values 
138152          bazel ${BAZEL_STARTUP_FLAGS[@]} run //crate_universe/tools/urls_generator \ 
@@ -151,20 +165,34 @@ jobs:
151165            --exclude="examples" \ 
152166            . 
153167
154-           # Save the sha256 checksum of the distro archive to the environment 
168+           # Save the sha256 checksum of the distro archive to the environment and output  
155169          sha256_base64="$(shasum --algorithm 256 ${{ github.workspace }}/.github/rules_rust.tar.gz | awk '{ print $1 }' | xxd -r -p | base64)" 
156170          echo "ARCHIVE_SHA256_BASE64=${sha256_base64}" >> $GITHUB_ENV 
171+           echo "archive_sha256_base64=${sha256_base64}" >> $GITHUB_OUTPUT 
157172         env :
158173          CARGO_BAZEL_GENERATOR_URL : file://${{ github.workspace }}/crate_universe/target/artifacts/x86_64-unknown-linux-gnu/cargo-bazel 
159174          ARTIFACTS_DIR : ${{ github.workspace }}/crate_universe/target/artifacts 
160175          URL_PREFIX : https://github.com/${{ github.repository_owner }}/rules_rust/releases/download/${{ env.RELEASE_VERSION }} 
161176
162-       #  Upload the artifact in case creating a release fails so all artifacts can then be manually recovered. 
177+       #  Upload the archive for review in PRs or manual recovery if release fails 
163178      - uses : actions/upload-artifact@v4 
164179        with :
165180          name : " rules_rust.tar.gz" 
166181          path : ${{ github.workspace }}/.github/rules_rust.tar.gz 
167182          if-no-files-found : error 
183+   release :
184+     if : startsWith(github.ref, 'refs/heads/main') 
185+     needs : [archive] 
186+     runs-on : ubuntu-22.04 
187+     steps :
188+       - uses : actions/checkout@v4 
189+       - uses : actions/download-artifact@v4 
190+         with :
191+           path : ${{ github.workspace }}/artifacts 
192+       - name : Set release version 
193+         run : | 
194+           echo "RELEASE_VERSION=${{ needs.archive.outputs.release_version }}" >> $GITHUB_ENV 
195+           echo "ARCHIVE_SHA256_BASE64=${{ needs.archive.outputs.archive_sha256_base64 }}" >> $GITHUB_ENV 
168196       - name : Generate release notes 
169197        run : | 
170198          # Generate the release notes 
@@ -189,7 +217,7 @@ jobs:
189217        with :
190218          upload_url : ${{ steps.rules_rust_release.outputs.upload_url }} 
191219          asset_name : rules_rust-${{ env.RELEASE_VERSION }}.tar.gz 
192-           asset_path : ${{ github.workspace }}/.github /rules_rust.tar.gz 
220+           asset_path : ${{ github.workspace }}/artifacts/rules_rust.tar.gz /rules_rust.tar.gz 
193221          asset_content_type : application/gzip 
194222
195223      #  There must be a upload action for each platform triple we create
@@ -200,7 +228,7 @@ jobs:
200228        with :
201229          upload_url : ${{ steps.rules_rust_release.outputs.upload_url }} 
202230          asset_name : cargo-bazel-aarch64-apple-darwin 
203-           asset_path : ${{ github.workspace }}/crate_universe/target/ artifacts/aarch64-apple-darwin/cargo-bazel 
231+           asset_path : ${{ github.workspace }}/artifacts/aarch64-apple-darwin/cargo-bazel 
204232          asset_content_type : application/octet-stream 
205233      - name : " Upload aarch64-pc-windows-msvc" 
206234        uses : actions/upload-release-asset@v1 
@@ -209,7 +237,7 @@ jobs:
209237        with :
210238          upload_url : ${{ steps.rules_rust_release.outputs.upload_url }} 
211239          asset_name : cargo-bazel-aarch64-pc-windows-msvc.exe 
212-           asset_path : ${{ github.workspace }}/crate_universe/target/ artifacts/aarch64-pc-windows-msvc/cargo-bazel.exe 
240+           asset_path : ${{ github.workspace }}/artifacts/aarch64-pc-windows-msvc/cargo-bazel.exe 
213241          asset_content_type : application/octet-stream 
214242      - name : " Upload aarch64-unknown-linux-gnu" 
215243        uses : actions/upload-release-asset@v1 
@@ -218,7 +246,7 @@ jobs:
218246        with :
219247          upload_url : ${{ steps.rules_rust_release.outputs.upload_url }} 
220248          asset_name : cargo-bazel-aarch64-unknown-linux-gnu 
221-           asset_path : ${{ github.workspace }}/crate_universe/target/ artifacts/aarch64-unknown-linux-gnu/cargo-bazel 
249+           asset_path : ${{ github.workspace }}/artifacts/aarch64-unknown-linux-gnu/cargo-bazel 
222250          asset_content_type : application/octet-stream 
223251      - name : " Upload s390x-unknown-linux-gnu" 
224252        uses : actions/upload-release-asset@v1 
@@ -227,7 +255,7 @@ jobs:
227255        with :
228256          upload_url : ${{ steps.rules_rust_release.outputs.upload_url }} 
229257          asset_name : cargo-bazel-s390x-unknown-linux-gnu 
230-           asset_path : ${{ github.workspace }}/crate_universe/target/ artifacts/s390x-unknown-linux-gnu/cargo-bazel 
258+           asset_path : ${{ github.workspace }}/artifacts/s390x-unknown-linux-gnu/cargo-bazel 
231259          asset_content_type : application/octet-stream 
232260      - name : " Upload x86_64-apple-darwin" 
233261        uses : actions/upload-release-asset@v1 
@@ -236,7 +264,7 @@ jobs:
236264        with :
237265          upload_url : ${{ steps.rules_rust_release.outputs.upload_url }} 
238266          asset_name : cargo-bazel-x86_64-apple-darwin 
239-           asset_path : ${{ github.workspace }}/crate_universe/target/ artifacts/x86_64-apple-darwin/cargo-bazel 
267+           asset_path : ${{ github.workspace }}/artifacts/x86_64-apple-darwin/cargo-bazel 
240268          asset_content_type : application/octet-stream 
241269      - name : " Upload x86_64-pc-windows-gnu" 
242270        uses : actions/upload-release-asset@v1 
@@ -245,7 +273,7 @@ jobs:
245273        with :
246274          upload_url : ${{ steps.rules_rust_release.outputs.upload_url }} 
247275          asset_name : cargo-bazel-x86_64-pc-windows-gnu.exe 
248-           asset_path : ${{ github.workspace }}/crate_universe/target/ artifacts/x86_64-pc-windows-gnu/cargo-bazel.exe 
276+           asset_path : ${{ github.workspace }}/artifacts/x86_64-pc-windows-gnu/cargo-bazel.exe 
249277          asset_content_type : application/octet-stream 
250278      - name : " Upload x86_64-pc-windows-msvc" 
251279        uses : actions/upload-release-asset@v1 
@@ -254,7 +282,7 @@ jobs:
254282        with :
255283          upload_url : ${{ steps.rules_rust_release.outputs.upload_url }} 
256284          asset_name : cargo-bazel-x86_64-pc-windows-msvc.exe 
257-           asset_path : ${{ github.workspace }}/crate_universe/target/ artifacts/x86_64-pc-windows-msvc/cargo-bazel.exe 
285+           asset_path : ${{ github.workspace }}/artifacts/x86_64-pc-windows-msvc/cargo-bazel.exe 
258286          asset_content_type : application/octet-stream 
259287      - name : " Upload x86_64-unknown-linux-gnu" 
260288        uses : actions/upload-release-asset@v1 
@@ -263,7 +291,7 @@ jobs:
263291        with :
264292          upload_url : ${{ steps.rules_rust_release.outputs.upload_url }} 
265293          asset_name : cargo-bazel-x86_64-unknown-linux-gnu 
266-           asset_path : ${{ github.workspace }}/crate_universe/target/ artifacts/x86_64-unknown-linux-gnu/cargo-bazel 
294+           asset_path : ${{ github.workspace }}/artifacts/x86_64-unknown-linux-gnu/cargo-bazel 
267295          asset_content_type : application/octet-stream 
268296      - name : " Upload x86_64-unknown-linux-musl" 
269297        uses : actions/upload-release-asset@v1 
@@ -272,7 +300,7 @@ jobs:
272300        with :
273301          upload_url : ${{ steps.rules_rust_release.outputs.upload_url }} 
274302          asset_name : cargo-bazel-x86_64-unknown-linux-musl 
275-           asset_path : ${{ github.workspace }}/crate_universe/target/ artifacts/x86_64-unknown-linux-musl/cargo-bazel 
303+           asset_path : ${{ github.workspace }}/artifacts/x86_64-unknown-linux-musl/cargo-bazel 
276304          asset_content_type : application/octet-stream 
277305      - name : " Upload aarch64-unknown-linux-musl" 
278306        uses : actions/upload-release-asset@v1 
@@ -281,5 +309,5 @@ jobs:
281309        with :
282310          upload_url : ${{ steps.rules_rust_release.outputs.upload_url }} 
283311          asset_name : cargo-bazel-aarch64-unknown-linux-musl 
284-           asset_path : ${{ github.workspace }}/crate_universe/target/ artifacts/aarch64-unknown-linux-musl/cargo-bazel 
312+           asset_path : ${{ github.workspace }}/artifacts/aarch64-unknown-linux-musl/cargo-bazel 
285313          asset_content_type : application/octet-stream 
0 commit comments