diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 983d0e1..091ae82 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,37 +1,36 @@ -# This workflow will upload a Python Package using Twine when a release is created -# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries +# Upload python package to pypi server and github release. +# Reference: https://packaging.python.org/en/latest/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/ -# This workflow uses actions that are not certified by GitHub. -# They are provided by a third-party and are governed by -# separate terms of service, privacy policy, and support -# documentation. - -name: Upload Python Package to PyPI when a Release is Created +name: Upload Python Package on: release: - types: [created] + types: [published] jobs: - pypi-publish: - name: Publish release to PyPI + publish-to-pypi: + name: >- + Publish distribution to PyPI runs-on: ubuntu-latest environment: name: pypi url: https://pypi.org/p/nomad-utility-workflows permissions: - id-token: write + id-token: write # IMPORTANT: mandatory for trusted publishing + steps: - uses: actions/checkout@v4 - name: Set up Python uses: actions/setup-python@v4 with: python-version: "3.11" - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install setuptools wheel - - name: Build package - run: python -m build - - name: Publish package distributions to PyPI + - 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: Publish distribution to PyPI uses: pypa/gh-action-pypi-publish@release/v1