From 39f3d3626d7afb2f27dae3c1a5eb161c59c1985f Mon Sep 17 00:00:00 2001 From: Daniel Bok Date: Tue, 12 Mar 2024 10:32:11 +0800 Subject: [PATCH] change twine upload creds --- .github/utils/find.py | 2 ++ .github/workflows/test-build-deploy.yml | 42 +++++++++++++++---------- 2 files changed, 28 insertions(+), 16 deletions(-) diff --git a/.github/utils/find.py b/.github/utils/find.py index d8e72dd..d974f01 100644 --- a/.github/utils/find.py +++ b/.github/utils/find.py @@ -48,6 +48,8 @@ def find_and_copy(from_folder: Path, else: pat = re.compile(pattern) + print(f"Copying files from {from_folder} to {to_folder}") + for file in Path(from_folder).rglob('*'): if file.is_file(): if pat is None or pat.search(file.as_posix()): diff --git a/.github/workflows/test-build-deploy.yml b/.github/workflows/test-build-deploy.yml index 2c0e5f9..660b701 100644 --- a/.github/workflows/test-build-deploy.yml +++ b/.github/workflows/test-build-deploy.yml @@ -203,17 +203,9 @@ jobs: with: python-version: '3.10' - - name: Retrieve packages - uses: actions/download-artifact@v4 - with: - path: dist - - name: Install twine run: pip install twine - - name: List repository - run: ls -al dist/* - - name: Checkout utilities uses: actions/checkout@v4 with: @@ -221,17 +213,22 @@ jobs: .github/utils sparse-checkout-cone-mode: false + - name: Retrieve packages + uses: actions/download-artifact@v4 + with: + path: dist + - name: Find and copy packages to files/ run: | mkdir files - ls -al .github/* - python .github/utils/find.py -from dist -pattern "(.tar.gz|.whl)$" -to files + ls -ltR + python .github/utils/find.py -from dist -to files -pattern "(.tar.gz|.whl)$" - name: Upload packages to testpypi env: - TWINE_USERNAME: ${{ secrets.PYPI_TEST_UID }} - TWINE_PASSWORD: ${{ secrets.PYPI_TEST_PWD }} - run: python -m twine upload --skip-existing --repository testpypi files/* + TWINE_USERNAME: ${{ secrets.PYPI_TEST_TOKEN_NAME }} + TWINE_PASSWORD: ${{ secrets.PYPI_TEST_API_TOKEN }} + run: python -m twine upload --skip-existing --repository testpypi files/* --verbose deploy: name: Deploy packages to PyPI @@ -245,16 +242,29 @@ jobs: with: python-version: '3.10' + - name: Install twine + run: pip install twine + + - name: Checkout utilities + uses: actions/checkout@v4 + with: + sparse-checkout: | + .github/utils + sparse-checkout-cone-mode: false + - name: Retrieve packages uses: actions/download-artifact@v4 with: path: dist - - name: Install twine - run: pip install twine + - name: Find and copy packages to files/ + run: | + mkdir files + ls -ltR + python .github/utils/find.py -from dist -to files -pattern "(.tar.gz|.whl)$" - name: Upload packages to pypi env: TWINE_USERNAME: ${{ secrets.PYPI_UID }} TWINE_PASSWORD: ${{ secrets.PYPI_PWD }} - run: python -m twine upload --skip-existing dist/* + run: python -m twine upload --skip-existing dist/* --verbose