Skip to content

Commit 8533183

Browse files
committed
Repackage sdist
1 parent 9a179c2 commit 8533183

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

.github/workflows/wheel-builder.yml

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,30 @@ 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+
targzname=$(find . -type f -name '*.tar.gz' -print0 | xargs -0 realpath)
49+
tarname="${targzname%.gz}"
50+
mkdir scratch
51+
tar xf "$targzname" -C scratch
52+
# cd into scratch so we can glob all files with `*`. Other approaches
53+
# like `-C scratch .` adds a leading `./` to the archive names.
54+
pushd scratch
55+
tar --sort=name --mtime="@$SOURCE_DATE_EPOCH" \
56+
--owner=0 --group=0 --numeric-owner \
57+
-cf "$tarname" -- *
58+
popd
59+
gzip --no-name "$tarname"
60+
rm -rf scratch
4361
- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
4462
with:
4563
name: sdist

0 commit comments

Comments
 (0)