Skip to content

Commit eccf9cb

Browse files
Remove package step from binary build workflow for releases (#1950)
1 parent 1477276 commit eccf9cb

File tree

2 files changed

+19
-14
lines changed

2 files changed

+19
-14
lines changed

.github/workflows/binaries.yml

+1-13
Original file line numberDiff line numberDiff line change
@@ -54,21 +54,9 @@ jobs:
5454
echo "VERSION=${version}" >> $GITHUB_ENV
5555
echo "NAME=${{ matrix.crate.name }}-${version}-${{ matrix.sys.target }}" >> $GITHUB_ENV
5656
57-
- name: Package (release only)
58-
if: github.event_name == 'release'
59-
run: cargo package --no-verify --package ${{ matrix.crate.name }}
60-
61-
- name: Package Extract (release only)
62-
if: github.event_name == 'release'
63-
run: |
64-
cd target/package
65-
tar xvfz ${{ matrix.crate.name }}-$VERSION.crate
66-
echo "BUILD_WORKING_DIR=target/package/${{ matrix.crate.name }}-$VERSION" >> $GITHUB_ENV
67-
6857
- name: Build
69-
working-directory: ${{ env.BUILD_WORKING_DIR }}
7058
run: |
71-
cargo build --target-dir="$GITHUB_WORKSPACE/target" --package ${{ matrix.crate.name }} --features opt --release --target ${{ matrix.sys.target }}
59+
cargo build --package ${{ matrix.crate.name }} --features opt --release --target ${{ matrix.sys.target }}
7260
7361
- name: Build provenance for attestation (release only)
7462
if: github.event_name == 'release'

.github/workflows/rust.yml

+18-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717

1818
complete:
1919
if: always()
20-
needs: [fmt, cargo-deny, check-generated-full-help-docs, build-and-test, publish-dry-run]
20+
needs: [fmt, cargo-deny, check-generated-full-help-docs, build-and-test, disallow-git-deps, publish-dry-run]
2121
runs-on: ubuntu-latest
2222
steps:
2323
- if: contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled')
@@ -98,6 +98,23 @@ jobs:
9898
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc
9999
CARGO_BUILD_TARGET: ${{ matrix.sys.target }}
100100

101+
disallow-git-deps:
102+
# This job fails if a release is being prepared and there are still crate
103+
# dependencies in the Cargo.toml files that reference dependencies via git.
104+
# Git dependencies should not be set when releasing because the binary
105+
# builds that happen based on the local source, and the published crate,
106+
# may not build to be the same. This is because when the crate is published
107+
# the git dependencies are stripped out automatically, but when building
108+
# locally they'd still be present. The presence of git dependencies at
109+
# release time in any case is probably a bug.
110+
if: github.event_name == 'push' || startsWith(github.head_ref, 'release/')
111+
runs-on: ubuntu-latest
112+
steps:
113+
- uses: actions/checkout@v4
114+
- name: Check that Cargo.tomls do not contain git dependencies for release
115+
run: |
116+
! git --no-pager grep 'git\s*=' -- Cargo.toml **/Cargo.toml
117+
101118
publish-dry-run:
102119
if: github.event_name == 'push' || startsWith(github.head_ref, 'release/')
103120
strategy:

0 commit comments

Comments
 (0)