CIDI: Including publishing workflows #1
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
| name: Build and Publish | |
| on: | |
| pull_request: | |
| push: | |
| tags: ["v*"] | |
| release: | |
| types: [published] | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| jobs: | |
| test_build_target: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version-file: .python-version | |
| - name: Build sdist + wheel | |
| run: | | |
| python -m pip install -U pip build | |
| python -m build --sdist --wheel --outdir dist | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: dist | |
| path: dist/* | |
| retention-days: 7 | |
| publish: | |
| needs: test_build_target | |
| runs-on: ubuntu-latest | |
| #if: startsWith(github.ref, 'refs/tags/v') || github.event_name == 'release' | |
| permissions: | |
| id-token: write | |
| contents: write | |
| steps: | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| name: dist | |
| path: dist | |
| - name: Publish to PyPI | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| with: | |
| packages-dir: dist | |
| - name: Upload to GitHub releases | |
| uses: softprops/action-gh-release@v2.4.1 | |
| with: | |
| draft: false | |
| generate_release_notes: false | |
| files: | | |
| dist/* |