Skip to content

Commit 912e3a3

Browse files
authored
ci: fixup release process (#1580)
1 parent fc29a29 commit 912e3a3

File tree

2 files changed

+10
-32
lines changed

2 files changed

+10
-32
lines changed

.github/workflows/publish_to_pypi.yml

Lines changed: 8 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
# https://packaging.python.org/en/latest/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/#the-whole-ci-cd-workflow
33
# but with the following differences
44
# - removed the TestPyPI part
5-
# - sanitise the `github.ref_name` part
65
# - instead of `on: push`, we have `tags` in there too
76

87
name: Publish Python 🐍 distribution 📦 to PyPI
@@ -85,38 +84,17 @@ jobs:
8584
- name: Create GitHub Release
8685
env:
8786
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 ""
10392
- name: Upload artifact signatures to GitHub Release
10493
env:
10594
GITHUB_TOKEN: ${{ github.token }}
10695
# Upload to GitHub Release using the `gh` CLI.
10796
# `dist/` contains the built packages, and the
10897
# 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/**

docs/security.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ good security practices. Here are some practices we follow:
55

66
- We publish to PyPI via trusted publishing and are PEP740-compliant.
77
- We don't use `pull_request_target` in any CI job.
8-
- We sanitise the (potentially unsafe) `github.ref_name` variable when publishing
9-
releases.
8+
- The release CI job can only be triggered for tag pushes, and only
9+
Narwhals members with release permissions (see below) can push tags.
1010
- All members of `narwhals-dev` are required to have two-factor authentication
1111
enabled.
1212
- There are no binary or opaque files in the Narwhals repository.

0 commit comments

Comments
 (0)