From 00eac00ccb23db17c7250292712e119da3ec8d97 Mon Sep 17 00:00:00 2001 From: Aymeric Galan Date: Tue, 30 Jul 2024 13:16:57 +0100 Subject: [PATCH] Fix pypi workflow files --- .github/workflows/publish-to-pypi.yml | 59 ++++++++++++++++------ .github/workflows/publish-to-testpypi.yml | 60 ++++++++++++++++------- CHANGELOG.md | 1 - 3 files changed, 86 insertions(+), 34 deletions(-) diff --git a/.github/workflows/publish-to-pypi.yml b/.github/workflows/publish-to-pypi.yml index 0783473..25ce0fc 100644 --- a/.github/workflows/publish-to-pypi.yml +++ b/.github/workflows/publish-to-pypi.yml @@ -1,25 +1,52 @@ -name: Publish to PyPi +name: Publish to PyPI on: workflow_dispatch jobs: - build-and-publish: - name: Build python package and publish to PyPi + build: + name: Build distribution runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: "3.x" + - name: Install pypa/build + run: >- + python3 -m + pip install + build + --user + - name: Build a binary wheel and a source tarball + run: python3 -m build + - name: Store the distribution packages + uses: actions/upload-artifact@v3 + with: + name: python-package-distributions + path: dist/ + + publish-to-pypi: + name: Publish distribution to PyPI + needs: + - build + runs-on: ubuntu-latest + + environment: + name: pypi + url: https://pypi.org/p/herculens + + permissions: + id-token: write # IMPORTANT: mandatory for trusted publishing + steps: - - uses: actions/checkout@master - - name: Set up Python 3.11 - uses: actions/setup-python@v2 + - name: Download the dists + uses: actions/download-artifact@v3 with: - python-version: 3.11 - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install setuptools wheel - - name: Build - run: python setup.py sdist bdist_wheel - - name: Publish to PyPi + name: python-package-distributions + path: dist/ + - name: Upload to PyPI uses: pypa/gh-action-pypi-publish@release/v1 with: - user: __token__ - password: ${{ secrets.PYPI_API_TOKEN }} + repository-url: https://pypi.org/legacy/ diff --git a/.github/workflows/publish-to-testpypi.yml b/.github/workflows/publish-to-testpypi.yml index fe4c147..051967a 100644 --- a/.github/workflows/publish-to-testpypi.yml +++ b/.github/workflows/publish-to-testpypi.yml @@ -1,26 +1,52 @@ -name: Publish to Test PyPi +name: Publish to Test PyPI on: workflow_dispatch jobs: - build-and-publish: - name: Build python package and publish to Test PyPi + build: + name: Build distribution runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: "3.x" + - name: Install pypa/build + run: >- + python3 -m + pip install + build + --user + - name: Build a binary wheel and a source tarball + run: python3 -m build + - name: Store the distribution packages + uses: actions/upload-artifact@v3 + with: + name: python-package-distributions + path: dist/ + + publish-to-testpypi: + name: Publish distribution to TestPyPI + needs: + - build + runs-on: ubuntu-latest + + environment: + name: testpypi + url: https://test.pypi.org/p/herculens + + permissions: + id-token: write # IMPORTANT: mandatory for trusted publishing + steps: - - uses: actions/checkout@master - - name: Set up Python 3.11 - uses: actions/setup-python@v2 + - name: Download the dists + uses: actions/download-artifact@v3 with: - python-version: 3.11 - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install setuptools wheel - - name: Build - run: python setup.py sdist bdist_wheel - - name: Publish to Test PyPi + name: python-package-distributions + path: dist/ + - name: Upload to TestPyPI uses: pypa/gh-action-pypi-publish@release/v1 with: - user: __token__ - password: ${{ secrets.TEST_PYPI_API_TOKEN }} - repository_url: https://test.pypi.org/legacy/ + repository-url: https://test.pypi.org/legacy/ diff --git a/CHANGELOG.md b/CHANGELOG.md index 77e9505..a63a98e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,5 @@ # Changelog ## 0.1.0 (2024-07-30) -++++++++++++++++++ * First release on PyPI.