Skip to content

Commit

Permalink
use token to upload to pypi (#6406)
Browse files Browse the repository at this point in the history
  • Loading branch information
NoureldinYosri authored Jan 10, 2024
1 parent c8f7ed7 commit ea6fabc
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
9 changes: 6 additions & 3 deletions .github/workflows/release-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,13 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
- name: Build and publish
- name: Create PYPI config file
env:
TWINE_USERNAME: ${{ secrets.PYPI_USER }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASS }}
CIRQ_PYPI_TOKEN: ${{ secrets.CIRQ_PYPI_TOKEN }}
CIRQ_TEST_PYPI_TOKEN: ${{ secrets.CIRQ_TEST_PYPI_TOKEN }}
run: |
dev_tools/packaging/create_pypirc.sh
- name: Build and publish
run: |
export CIRQ_PRE_RELEASE_VERSION=$(dev_tools/packaging/generate-dev-version-id.sh)
[[ "$CIRQ_PRE_RELEASE_VERSION" =~ .*dev.* ]] && echo "Deploying dev version '$CIRQ_PRE_RELEASE_VERSION'" || (echo "not dev version"; exit 1)
Expand Down
13 changes: 13 additions & 0 deletions dev_tools/packaging/create_pypirc.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!bin/bash

# Create default pypi config file with token authentication.
# refrence: https://packaging.python.org/en/latest/specifications/pypirc/#common-configurations
echo """
[pypi]
username = __token__
password = ${CIRQ_PYPI_TOKEN}
[testpypi]
username = __token__
password = ${CIRQ_TEST_PYPI_TOKEN}
""" >> $HOME/.pypirc

0 comments on commit ea6fabc

Please sign in to comment.