Skip to content

Commit ea6fabc

Browse files
use token to upload to pypi (#6406)
1 parent c8f7ed7 commit ea6fabc

File tree

2 files changed

+19
-3
lines changed

2 files changed

+19
-3
lines changed

.github/workflows/release-main.yml

+6-3
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,13 @@ jobs:
2121
run: |
2222
python -m pip install --upgrade pip
2323
pip install setuptools wheel twine
24-
- name: Build and publish
24+
- name: Create PYPI config file
2525
env:
26-
TWINE_USERNAME: ${{ secrets.PYPI_USER }}
27-
TWINE_PASSWORD: ${{ secrets.PYPI_PASS }}
26+
CIRQ_PYPI_TOKEN: ${{ secrets.CIRQ_PYPI_TOKEN }}
27+
CIRQ_TEST_PYPI_TOKEN: ${{ secrets.CIRQ_TEST_PYPI_TOKEN }}
28+
run: |
29+
dev_tools/packaging/create_pypirc.sh
30+
- name: Build and publish
2831
run: |
2932
export CIRQ_PRE_RELEASE_VERSION=$(dev_tools/packaging/generate-dev-version-id.sh)
3033
[[ "$CIRQ_PRE_RELEASE_VERSION" =~ .*dev.* ]] && echo "Deploying dev version '$CIRQ_PRE_RELEASE_VERSION'" || (echo "not dev version"; exit 1)

dev_tools/packaging/create_pypirc.sh

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!bin/bash
2+
3+
# Create default pypi config file with token authentication.
4+
# refrence: https://packaging.python.org/en/latest/specifications/pypirc/#common-configurations
5+
echo """
6+
[pypi]
7+
username = __token__
8+
password = ${CIRQ_PYPI_TOKEN}
9+
10+
[testpypi]
11+
username = __token__
12+
password = ${CIRQ_TEST_PYPI_TOKEN}
13+
""" >> $HOME/.pypirc

0 commit comments

Comments
 (0)