From baa84bdd3c66b9685e3dd2dba544448438768145 Mon Sep 17 00:00:00 2001 From: mferrera Date: Tue, 24 Sep 2024 07:11:57 +0200 Subject: [PATCH] CI: Update to trusted publisher workflow --- .github/workflows/fmuconfig-publish-pypi.yml | 46 ++++++++++++-------- 1 file changed, 29 insertions(+), 17 deletions(-) diff --git a/.github/workflows/fmuconfig-publish-pypi.yml b/.github/workflows/fmuconfig-publish-pypi.yml index 1583852..55ce2b5 100644 --- a/.github/workflows/fmuconfig-publish-pypi.yml +++ b/.github/workflows/fmuconfig-publish-pypi.yml @@ -1,25 +1,37 @@ -name: Publish Python 🐍 distributions 📦 to PyPI +name: Publish to PyPI on: release: - types: [created] + types: [published] jobs: - build-n-publish: - name: Build and publish Python 🐍 distributions 📦 to PyPI + pypi-publish: + name: Upload release to PyPI runs-on: ubuntu-latest + environment: + name: pypi + url: https://pypi.org/p/subscript + permissions: + id-token: write + steps: - - uses: actions/checkout@master - - name: Set up Python 3.8 - uses: actions/setup-python@v1 + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Set up Python 3.11 + uses: actions/setup-python@v5 with: - python-version: 3.8 - - name: Install dependencies - run: pip install --upgrade setuptools wheel twine - - name: Build package - run: python setup.py sdist bdist_wheel - - name: Upload deploy - env: - TWINE_USERNAME: __token__ - TWINE_PASSWORD: ${{ secrets.PYPI_SECRET }} - run: python -m twine upload dist/* + python-version: 3.11 + + - name: Install build dependencies + run: | + pip install -U pip + pip install build + + - name: Build distributions + run: python -m build + + - name: Publish package distributions to PyPI + uses: pypa/gh-action-pypi-publish@release/v1