|
2 | 2 | # https://packaging.python.org/en/latest/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/#the-whole-ci-cd-workflow
|
3 | 3 | # but with the following differences
|
4 | 4 | # - removed the TestPyPI part
|
5 |
| -# - sanitise the `github.ref_name` part |
6 | 5 | # - instead of `on: push`, we have `tags` in there too
|
7 | 6 |
|
8 | 7 | name: Publish Python 🐍 distribution 📦 to PyPI
|
@@ -85,38 +84,17 @@ jobs:
|
85 | 84 | - name: Create GitHub Release
|
86 | 85 | env:
|
87 | 86 | GITHUB_TOKEN: ${{ github.token }}
|
88 |
| - run: | |
89 |
| - # Sanitize ref_name by removing unsafe characters |
90 |
| - SAFE_REF_NAME=$(echo '${{ github.ref_name }}' | tr -cd '[:alnum:]-_') |
91 |
| -
|
92 |
| - # Validate that the sanitized name is not empty (to avoid invalid input) |
93 |
| - if [ -z "$SAFE_REF_NAME" ]; then |
94 |
| - echo "Sanitized reference name is empty. Exiting." |
95 |
| - exit 1 |
96 |
| - fi |
97 |
| -
|
98 |
| - # Use the sanitized name in the gh command |
99 |
| - gh release create \ |
100 |
| - "$SAFE_REF_NAME" \ |
101 |
| - --repo '${{ github.repository }}' \ |
102 |
| - --notes "" |
| 87 | + run: >- |
| 88 | + gh release create |
| 89 | + '${{ github.ref_name }}' |
| 90 | + --repo '${{ github.repository }}' |
| 91 | + --notes "" |
103 | 92 | - name: Upload artifact signatures to GitHub Release
|
104 | 93 | env:
|
105 | 94 | GITHUB_TOKEN: ${{ github.token }}
|
106 | 95 | # Upload to GitHub Release using the `gh` CLI.
|
107 | 96 | # `dist/` contains the built packages, and the
|
108 | 97 | # sigstore-produced signatures and certificates.
|
109 |
| - run: | |
110 |
| - # Sanitize ref_name by removing unsafe characters |
111 |
| - SAFE_REF_NAME=$(echo '${{ github.ref_name }}' | tr -cd '[:alnum:]-_') |
112 |
| -
|
113 |
| - # Validate that the sanitized name is not empty (to avoid invalid input) |
114 |
| - if [ -z "$SAFE_REF_NAME" ]; then |
115 |
| - echo "Sanitized reference name is empty. Exiting." |
116 |
| - exit 1 |
117 |
| - fi |
118 |
| -
|
119 |
| - # Use the sanitized name in the gh command |
120 |
| - gh release upload \ |
121 |
| - "$SAFE_REF_NAME" dist/** \ |
122 |
| - --repo '${{ github.repository }}' |
| 98 | + run: >- |
| 99 | + gh release upload |
| 100 | + '${{ github.ref_name }}' dist/** |
0 commit comments