Repository navigation
Merge pull request #229 from easyscience/hot-fix-pypi #16
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Builds a Python package and publish it to PyPI when a new tag is | |
| # created. | |
| name: PyPI publishing | |
| on: | |
| # Runs on creating a new tag starting with 'v', e.g. 'v1.0.3' | |
| push: | |
| tags: ['v*'] | |
| # Allows you to run this workflow manually from the Actions tab | |
| workflow_dispatch: | |
| jobs: | |
| pypi-publish: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| id-token: write # IMPORTANT: this permission is mandatory for trusted publishing | |
| steps: | |
| - name: Check-out repository | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 # full history with tags to get the version number by versioningit | |
| - name: Set up pixi | |
| uses: ./.github/actions/setup-pixi | |
| # Build the Python package (to dist/ folder) | |
| - name: Create Python package | |
| run: pixi run --frozen default-build | |
| # Publish the package to PyPI (from dist/ folder) | |
| # Instead of publishing with personal access token, we use | |
| # GitHub Actions OIDC to get a short-lived token from PyPI. | |
| # New publisher must be previously configured in PyPI at | |
| # https://pypi.org/manage/project/easydiffraction/settings/publishing/ | |
| # Use the following data: | |
| # Owner: easyscience | |
| # Repository name: diffraction-lib | |
| # Workflow name: pypi-publish.yml | |
| - name: Publish to PyPI | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| with: | |
| packages-dir: 'dist' |