From 3c21ee5e35bb9ad33b2406b78fa3d913dee114d4 Mon Sep 17 00:00:00 2001 From: Dylan Hercher Date: Mon, 28 Jun 2021 16:53:06 -0700 Subject: [PATCH] docs: add secrets logic to ci (#273) --- ci/cloudbuild_pypi.yaml | 4 ++-- ci/release_pypi.sh | 6 ++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/ci/cloudbuild_pypi.yaml b/ci/cloudbuild_pypi.yaml index 7b487e577..5ac72d4aa 100644 --- a/ci/cloudbuild_pypi.yaml +++ b/ci/cloudbuild_pypi.yaml @@ -23,8 +23,8 @@ steps: - 'TWINE_PASSWORD=${_TWINE_PASSWORD}' - 'TWINE_REPOSITORY_URL=${_TWINE_REPOSITORY_URL}' substitutions: - _TWINE_USERNAME: username - _TWINE_PASSWORD: password + _TWINE_USERNAME: __token__ + _TWINE_PASSWORD: _TWINE_REPOSITORY_URL: https://upload.pypi.org/legacy/ options: substitution_option: 'ALLOW_LOOSE' diff --git a/ci/release_pypi.sh b/ci/release_pypi.sh index 48aa3a346..18475d137 100644 --- a/ci/release_pypi.sh +++ b/ci/release_pypi.sh @@ -13,6 +13,12 @@ # See the License for the specific language governing permissions and # limitations under the License. + +if [ "${TWINE_PASSWORD}" == "" ] +then + TWINE_PASSWORD=$(gcloud secrets versions access latest --secret="data-validation" --project=${PROJECT_ID}) +fi + python3 -m pip install --upgrade build setuptools twine wheel python3 -m build python3 -m twine upload dist/*