Skip to content

Commit 9c1f5b5

Browse files
authored
chore: Update PyPi to use trusted publisher for authentication and correctly escape change log body. (#759)
* fix: Escape release tag body and change PyPi to use trusted publisher for authentication. * fix typo
1 parent 2376584 commit 9c1f5b5

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

.github/scripts/publish_preflight_check.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ echo "$CHANGELOG"
173173
# and https://github.com/github/docs/issues/21529#issue-1418590935
174174
FILTERED_CHANGELOG=`echo "$CHANGELOG" | grep -v "\\[INFO\\]"`
175175
echo "changelog<<CHANGELOGEOF" >> $GITHUB_OUTPUT
176-
echo "$FILTERED_CHANGELOG" >> $GITHUB_OUTPUT
176+
echo -e "$FILTERED_CHANGELOG" >> $GITHUB_OUTPUT
177177
echo "CHANGELOGEOF" >> $GITHUB_OUTPUT
178178

179179

.github/workflows/release.yml

+6-4
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,11 @@ jobs:
9292
startsWith(github.event.pull_request.title, '[chore] Release ')
9393

9494
runs-on: ubuntu-latest
95+
permissions:
96+
# Used to create a short-lived OIDC token which is given to PyPi to identify this workflow job
97+
# See: https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/about-security-hardening-with-openid-connect#adding-permissions-settings
98+
# and https://docs.pypi.org/trusted-publishers/using-a-publisher/
99+
id-token: write
95100

96101
steps:
97102
- name: Checkout source for publish
@@ -116,10 +121,7 @@ jobs:
116121
--notes "${{ steps.preflight.outputs.changelog }}"
117122

118123
- name: Publish to Pypi
119-
uses: pypa/[email protected]
120-
with:
121-
user: firebase
122-
password: ${{ secrets.PYPI_PASSWORD }}
124+
uses: pypa/gh-action-pypi-publish@release/v1
123125

124126
# Post to Twitter if explicitly opted-in by adding the label 'release:tweet'.
125127
- name: Post to Twitter

0 commit comments

Comments
 (0)