Skip to content

Commit 703b6c5

Browse files
committed
Repackage sdist
1 parent 9a179c2 commit 703b6c5

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

.github/workflows/wheel-builder.yml

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,29 @@ jobs:
3434
- run: python -m venv .venv
3535
- name: Install Python dependencies
3636
run: .venv/bin/pip install -U pip build
37+
- name: Make sdist
38+
run: .venv/bin/python -m build --sdist
3739
- name: Set SOURCE_DATE_EPOCH to last commit for reproducible build
3840
run: |
3941
echo "SOURCE_DATE_EPOCH=$(git log -1 --pretty=%ct)"
4042
echo "SOURCE_DATE_EPOCH=$(git log -1 --pretty=%ct)" >> $GITHUB_ENV
41-
- name: Make sdist
42-
run: .venv/bin/python -m build --sdist
43+
- name: Repackage using SOURCE_DATE_EPOCH
44+
run: |
45+
set -xe
46+
47+
cd dist
48+
filename=$(find . -type f -name '*.tar.gz' -print0 | xargs -0 realpath)
49+
mkdir scratch
50+
tar xf "$filename" -C scratch
51+
# cd into scratch so we can glob all files with `*`. Other approaches
52+
# like `-C scratch .` adds a leading `./` to the archive names.
53+
pushd scratch
54+
export GZIP=--no-name
55+
tar --sort=name --mtime="@$SOURCE_DATE_EPOCH" \
56+
--owner=0 --group=0 --numeric-owner \
57+
-czf "$filename" -- *
58+
popd
59+
rm -rf scratch
4360
- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
4461
with:
4562
name: sdist

0 commit comments

Comments
 (0)