Skip to content

Commit 0278724

Browse files
authored
fix the release process (#21966)
Fix the release process which broke with introduction of the attestation workflow in #21953 due to me not properly moving the artifact rename logic entirely.
1 parent 31c19f3 commit 0278724

File tree

2 files changed

+73
-49
lines changed

2 files changed

+73
-49
lines changed

.github/workflows/release.yaml

+68-44
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,21 @@ jobs:
8484
subject-path: dist/deploy/wheels/pantsbuild.pants/**/pantsbuild.pants-*.whl
8585
- if: needs.release_info.outputs.is-release == 'true'
8686
name: Rename the Pants Pex to its final name for upload
87-
run: 'PEX_FILENAME=pants.$PANTS_VER-$PY_VER-$PLAT.pex
87+
run: 'PANTS_VER=$(PEX_INTERPRETER=1 dist/src.python.pants/pants-pex.pex -c "import
88+
pants.version;print(pants.version.VERSION)")
89+
90+
PY_VER=$(PEX_INTERPRETER=1 dist/src.python.pants/pants-pex.pex -c "import
91+
sys;print(f''cp{sys.version_info[0]}{sys.version_info[1]}'')")
92+
93+
PLAT=$(PEX_INTERPRETER=1 dist/src.python.pants/pants-pex.pex -c "import os;print(f''{os.uname().sysname.lower()}_{os.uname().machine.lower()}'')")
94+
95+
PEX_FILENAME=pants.$PANTS_VER-$PY_VER-$PLAT.pex
96+
8897
8998
mv dist/src.python.pants/pants-pex.pex dist/src.python.pants/$PEX_FILENAME
9099
100+
echo "PEX_FILENAME=$PEX_FILENAME" | tee -a "$GITHUB_ENV"
101+
91102
'
92103
- continue-on-error: true
93104
if: needs.release_info.outputs.is-release == 'true'
@@ -97,16 +108,11 @@ jobs:
97108
subject-path: dist/src.python.pants/*.pex
98109
- if: needs.release_info.outputs.is-release == 'true'
99110
name: Upload Wheel and Pex
100-
run: "PANTS_VER=$(PEX_INTERPRETER=1 dist/src.python.pants/pants-pex.pex -c \"\
101-
import pants.version;print(pants.version.VERSION)\")\nPY_VER=$(PEX_INTERPRETER=1\
102-
\ dist/src.python.pants/pants-pex.pex -c \"import sys;print(f'cp{sys.version_info[0]}{sys.version_info[1]}')\"\
103-
)\nPLAT=$(PEX_INTERPRETER=1 dist/src.python.pants/pants-pex.pex -c \"import\
104-
\ os;print(f'{os.uname().sysname.lower()}_{os.uname().machine.lower()}')\"\
105-
)\nPEX_FILENAME=pants.$PANTS_VER-$PY_VER-$PLAT.pex\n\ncurl -L --fail \\\n\
106-
\ -X POST \\\n -H \"Authorization: Bearer ${{ github.token }}\" \\\n\
107-
\ -H \"Content-Type: application/octet-stream\" \\\n ${{ needs.release_info.outputs.release-asset-upload-url\
108-
\ }}?name=$PEX_FILENAME \\\n --data-binary \"@dist/src.python.pants/$PEX_FILENAME\"\
109-
\n\nWHL=$(find dist/deploy/wheels/pantsbuild.pants -type f -name \"pantsbuild.pants-*.whl\"\
111+
run: "curl -L --fail \\\n -X POST \\\n -H \"Authorization: Bearer ${{\
112+
\ github.token }}\" \\\n -H \"Content-Type: application/octet-stream\"\
113+
\ \\\n ${{ needs.release_info.outputs.release-asset-upload-url }}?name=$PEX_FILENAME\
114+
\ \\\n --data-binary \"@dist/src.python.pants/$PEX_FILENAME\"\n\nWHL=$(find\
115+
\ dist/deploy/wheels/pantsbuild.pants -type f -name \"pantsbuild.pants-*.whl\"\
110116
)\ncurl -L --fail \\\n -X POST \\\n -H \"Authorization: Bearer ${{ github.token\
111117
\ }}\" \\\n -H \"Content-Type: application/octet-stream\" \\\n \"${{\
112118
\ needs.release_info.outputs.release-asset-upload-url }}?name=$(basename $WHL)\"\
@@ -192,10 +198,21 @@ jobs:
192198
subject-path: dist/deploy/wheels/pantsbuild.pants/**/pantsbuild.pants-*.whl
193199
- if: needs.release_info.outputs.is-release == 'true'
194200
name: Rename the Pants Pex to its final name for upload
195-
run: 'PEX_FILENAME=pants.$PANTS_VER-$PY_VER-$PLAT.pex
201+
run: 'PANTS_VER=$(PEX_INTERPRETER=1 dist/src.python.pants/pants-pex.pex -c "import
202+
pants.version;print(pants.version.VERSION)")
203+
204+
PY_VER=$(PEX_INTERPRETER=1 dist/src.python.pants/pants-pex.pex -c "import
205+
sys;print(f''cp{sys.version_info[0]}{sys.version_info[1]}'')")
206+
207+
PLAT=$(PEX_INTERPRETER=1 dist/src.python.pants/pants-pex.pex -c "import os;print(f''{os.uname().sysname.lower()}_{os.uname().machine.lower()}'')")
208+
209+
PEX_FILENAME=pants.$PANTS_VER-$PY_VER-$PLAT.pex
210+
196211
197212
mv dist/src.python.pants/pants-pex.pex dist/src.python.pants/$PEX_FILENAME
198213
214+
echo "PEX_FILENAME=$PEX_FILENAME" | tee -a "$GITHUB_ENV"
215+
199216
'
200217
- continue-on-error: true
201218
if: needs.release_info.outputs.is-release == 'true'
@@ -205,16 +222,11 @@ jobs:
205222
subject-path: dist/src.python.pants/*.pex
206223
- if: needs.release_info.outputs.is-release == 'true'
207224
name: Upload Wheel and Pex
208-
run: "PANTS_VER=$(PEX_INTERPRETER=1 dist/src.python.pants/pants-pex.pex -c \"\
209-
import pants.version;print(pants.version.VERSION)\")\nPY_VER=$(PEX_INTERPRETER=1\
210-
\ dist/src.python.pants/pants-pex.pex -c \"import sys;print(f'cp{sys.version_info[0]}{sys.version_info[1]}')\"\
211-
)\nPLAT=$(PEX_INTERPRETER=1 dist/src.python.pants/pants-pex.pex -c \"import\
212-
\ os;print(f'{os.uname().sysname.lower()}_{os.uname().machine.lower()}')\"\
213-
)\nPEX_FILENAME=pants.$PANTS_VER-$PY_VER-$PLAT.pex\n\ncurl -L --fail \\\n\
214-
\ -X POST \\\n -H \"Authorization: Bearer ${{ github.token }}\" \\\n\
215-
\ -H \"Content-Type: application/octet-stream\" \\\n ${{ needs.release_info.outputs.release-asset-upload-url\
216-
\ }}?name=$PEX_FILENAME \\\n --data-binary \"@dist/src.python.pants/$PEX_FILENAME\"\
217-
\n\nWHL=$(find dist/deploy/wheels/pantsbuild.pants -type f -name \"pantsbuild.pants-*.whl\"\
225+
run: "curl -L --fail \\\n -X POST \\\n -H \"Authorization: Bearer ${{\
226+
\ github.token }}\" \\\n -H \"Content-Type: application/octet-stream\"\
227+
\ \\\n ${{ needs.release_info.outputs.release-asset-upload-url }}?name=$PEX_FILENAME\
228+
\ \\\n --data-binary \"@dist/src.python.pants/$PEX_FILENAME\"\n\nWHL=$(find\
229+
\ dist/deploy/wheels/pantsbuild.pants -type f -name \"pantsbuild.pants-*.whl\"\
218230
)\ncurl -L --fail \\\n -X POST \\\n -H \"Authorization: Bearer ${{ github.token\
219231
\ }}\" \\\n -H \"Content-Type: application/octet-stream\" \\\n \"${{\
220232
\ needs.release_info.outputs.release-asset-upload-url }}?name=$(basename $WHL)\"\
@@ -329,10 +341,21 @@ jobs:
329341
subject-path: dist/deploy/wheels/pantsbuild.pants/**/pantsbuild.pants-*.whl
330342
- if: needs.release_info.outputs.is-release == 'true'
331343
name: Rename the Pants Pex to its final name for upload
332-
run: 'PEX_FILENAME=pants.$PANTS_VER-$PY_VER-$PLAT.pex
344+
run: 'PANTS_VER=$(PEX_INTERPRETER=1 dist/src.python.pants/pants-pex.pex -c "import
345+
pants.version;print(pants.version.VERSION)")
346+
347+
PY_VER=$(PEX_INTERPRETER=1 dist/src.python.pants/pants-pex.pex -c "import
348+
sys;print(f''cp{sys.version_info[0]}{sys.version_info[1]}'')")
349+
350+
PLAT=$(PEX_INTERPRETER=1 dist/src.python.pants/pants-pex.pex -c "import os;print(f''{os.uname().sysname.lower()}_{os.uname().machine.lower()}'')")
351+
352+
PEX_FILENAME=pants.$PANTS_VER-$PY_VER-$PLAT.pex
353+
333354
334355
mv dist/src.python.pants/pants-pex.pex dist/src.python.pants/$PEX_FILENAME
335356
357+
echo "PEX_FILENAME=$PEX_FILENAME" | tee -a "$GITHUB_ENV"
358+
336359
'
337360
- continue-on-error: true
338361
if: needs.release_info.outputs.is-release == 'true'
@@ -342,16 +365,11 @@ jobs:
342365
subject-path: dist/src.python.pants/*.pex
343366
- if: needs.release_info.outputs.is-release == 'true'
344367
name: Upload Wheel and Pex
345-
run: "PANTS_VER=$(PEX_INTERPRETER=1 dist/src.python.pants/pants-pex.pex -c \"\
346-
import pants.version;print(pants.version.VERSION)\")\nPY_VER=$(PEX_INTERPRETER=1\
347-
\ dist/src.python.pants/pants-pex.pex -c \"import sys;print(f'cp{sys.version_info[0]}{sys.version_info[1]}')\"\
348-
)\nPLAT=$(PEX_INTERPRETER=1 dist/src.python.pants/pants-pex.pex -c \"import\
349-
\ os;print(f'{os.uname().sysname.lower()}_{os.uname().machine.lower()}')\"\
350-
)\nPEX_FILENAME=pants.$PANTS_VER-$PY_VER-$PLAT.pex\n\ncurl -L --fail \\\n\
351-
\ -X POST \\\n -H \"Authorization: Bearer ${{ github.token }}\" \\\n\
352-
\ -H \"Content-Type: application/octet-stream\" \\\n ${{ needs.release_info.outputs.release-asset-upload-url\
353-
\ }}?name=$PEX_FILENAME \\\n --data-binary \"@dist/src.python.pants/$PEX_FILENAME\"\
354-
\n\nWHL=$(find dist/deploy/wheels/pantsbuild.pants -type f -name \"pantsbuild.pants-*.whl\"\
368+
run: "curl -L --fail \\\n -X POST \\\n -H \"Authorization: Bearer ${{\
369+
\ github.token }}\" \\\n -H \"Content-Type: application/octet-stream\"\
370+
\ \\\n ${{ needs.release_info.outputs.release-asset-upload-url }}?name=$PEX_FILENAME\
371+
\ \\\n --data-binary \"@dist/src.python.pants/$PEX_FILENAME\"\n\nWHL=$(find\
372+
\ dist/deploy/wheels/pantsbuild.pants -type f -name \"pantsbuild.pants-*.whl\"\
355373
)\ncurl -L --fail \\\n -X POST \\\n -H \"Authorization: Bearer ${{ github.token\
356374
\ }}\" \\\n -H \"Content-Type: application/octet-stream\" \\\n \"${{\
357375
\ needs.release_info.outputs.release-asset-upload-url }}?name=$(basename $WHL)\"\
@@ -449,10 +467,21 @@ jobs:
449467
subject-path: dist/deploy/wheels/pantsbuild.pants/**/pantsbuild.pants-*.whl
450468
- if: needs.release_info.outputs.is-release == 'true'
451469
name: Rename the Pants Pex to its final name for upload
452-
run: 'PEX_FILENAME=pants.$PANTS_VER-$PY_VER-$PLAT.pex
470+
run: 'PANTS_VER=$(PEX_INTERPRETER=1 dist/src.python.pants/pants-pex.pex -c "import
471+
pants.version;print(pants.version.VERSION)")
472+
473+
PY_VER=$(PEX_INTERPRETER=1 dist/src.python.pants/pants-pex.pex -c "import
474+
sys;print(f''cp{sys.version_info[0]}{sys.version_info[1]}'')")
475+
476+
PLAT=$(PEX_INTERPRETER=1 dist/src.python.pants/pants-pex.pex -c "import os;print(f''{os.uname().sysname.lower()}_{os.uname().machine.lower()}'')")
477+
478+
PEX_FILENAME=pants.$PANTS_VER-$PY_VER-$PLAT.pex
479+
453480
454481
mv dist/src.python.pants/pants-pex.pex dist/src.python.pants/$PEX_FILENAME
455482
483+
echo "PEX_FILENAME=$PEX_FILENAME" | tee -a "$GITHUB_ENV"
484+
456485
'
457486
- continue-on-error: true
458487
if: needs.release_info.outputs.is-release == 'true'
@@ -462,16 +491,11 @@ jobs:
462491
subject-path: dist/src.python.pants/*.pex
463492
- if: needs.release_info.outputs.is-release == 'true'
464493
name: Upload Wheel and Pex
465-
run: "PANTS_VER=$(PEX_INTERPRETER=1 dist/src.python.pants/pants-pex.pex -c \"\
466-
import pants.version;print(pants.version.VERSION)\")\nPY_VER=$(PEX_INTERPRETER=1\
467-
\ dist/src.python.pants/pants-pex.pex -c \"import sys;print(f'cp{sys.version_info[0]}{sys.version_info[1]}')\"\
468-
)\nPLAT=$(PEX_INTERPRETER=1 dist/src.python.pants/pants-pex.pex -c \"import\
469-
\ os;print(f'{os.uname().sysname.lower()}_{os.uname().machine.lower()}')\"\
470-
)\nPEX_FILENAME=pants.$PANTS_VER-$PY_VER-$PLAT.pex\n\ncurl -L --fail \\\n\
471-
\ -X POST \\\n -H \"Authorization: Bearer ${{ github.token }}\" \\\n\
472-
\ -H \"Content-Type: application/octet-stream\" \\\n ${{ needs.release_info.outputs.release-asset-upload-url\
473-
\ }}?name=$PEX_FILENAME \\\n --data-binary \"@dist/src.python.pants/$PEX_FILENAME\"\
474-
\n\nWHL=$(find dist/deploy/wheels/pantsbuild.pants -type f -name \"pantsbuild.pants-*.whl\"\
494+
run: "curl -L --fail \\\n -X POST \\\n -H \"Authorization: Bearer ${{\
495+
\ github.token }}\" \\\n -H \"Content-Type: application/octet-stream\"\
496+
\ \\\n ${{ needs.release_info.outputs.release-asset-upload-url }}?name=$PEX_FILENAME\
497+
\ \\\n --data-binary \"@dist/src.python.pants/$PEX_FILENAME\"\n\nWHL=$(find\
498+
\ dist/deploy/wheels/pantsbuild.pants -type f -name \"pantsbuild.pants-*.whl\"\
475499
)\ncurl -L --fail \\\n -X POST \\\n -H \"Authorization: Bearer ${{ github.token\
476500
\ }}\" \\\n -H \"Content-Type: application/octet-stream\" \\\n \"${{\
477501
\ needs.release_info.outputs.release-asset-upload-url }}?name=$(basename $WHL)\"\

src/python/pants_release/generate_github_workflows.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -932,8 +932,13 @@ def build_wheels_job(
932932
"if": "needs.release_info.outputs.is-release == 'true'",
933933
"run": dedent(
934934
"""\
935+
PANTS_VER=$(PEX_INTERPRETER=1 dist/src.python.pants/pants-pex.pex -c "import pants.version;print(pants.version.VERSION)")
936+
PY_VER=$(PEX_INTERPRETER=1 dist/src.python.pants/pants-pex.pex -c "import sys;print(f'cp{sys.version_info[0]}{sys.version_info[1]}')")
937+
PLAT=$(PEX_INTERPRETER=1 dist/src.python.pants/pants-pex.pex -c "import os;print(f'{os.uname().sysname.lower()}_{os.uname().machine.lower()}')")
935938
PEX_FILENAME=pants.$PANTS_VER-$PY_VER-$PLAT.pex
939+
936940
mv dist/src.python.pants/pants-pex.pex dist/src.python.pants/$PEX_FILENAME
941+
echo "PEX_FILENAME=$PEX_FILENAME" | tee -a "$GITHUB_ENV"
937942
"""
938943
),
939944
},
@@ -956,11 +961,6 @@ def build_wheels_job(
956961
# support. `curl` is a good lowest-common-denominator way to upload the assets.
957962
"run": dedent(
958963
"""\
959-
PANTS_VER=$(PEX_INTERPRETER=1 dist/src.python.pants/pants-pex.pex -c "import pants.version;print(pants.version.VERSION)")
960-
PY_VER=$(PEX_INTERPRETER=1 dist/src.python.pants/pants-pex.pex -c "import sys;print(f'cp{sys.version_info[0]}{sys.version_info[1]}')")
961-
PLAT=$(PEX_INTERPRETER=1 dist/src.python.pants/pants-pex.pex -c "import os;print(f'{os.uname().sysname.lower()}_{os.uname().machine.lower()}')")
962-
PEX_FILENAME=pants.$PANTS_VER-$PY_VER-$PLAT.pex
963-
964964
curl -L --fail \\
965965
-X POST \\
966966
-H "Authorization: Bearer ${{ github.token }}" \\

0 commit comments

Comments
 (0)