update documentation #258
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: Publish Python package to PyPI | |
| on: | |
| push: | |
| branches: | |
| - "**" | |
| tags: | |
| - "v*" | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| jobs: | |
| build-and-publish: | |
| runs-on: ubuntu-24.04 | |
| name: Build Python package, publish to (Test-)PyPI | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Poetry | |
| run: pipx install poetry~=2.1.3 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: 3.11 | |
| cache: "poetry" | |
| - name: Setup project with Poetry | |
| run: | | |
| python --version; python -m pip --version; poetry --version | |
| poetry install --no-interaction | |
| - name: Build a Python package | |
| run: | | |
| bash scripts/build_py.sh | |
| - name: Archive the built Python package | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: smartmeter-datacollector-py | |
| path: dist/* | |
| - name: Publish the Python package to Test PyPI | |
| if: github.ref == 'refs/heads/master' | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| with: | |
| password: ${{ secrets.TEST_PYPI_API_TOKEN }} | |
| repository-url: https://test.pypi.org/legacy/ | |
| verify-metadata: true | |
| verbose: true | |
| skip-existing: true | |
| attestations: false | |
| - name: Publish the Python package to PyPI | |
| if: startsWith(github.ref, 'refs/tags') | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| with: | |
| password: ${{ secrets.PYPI_API_TOKEN }} | |
| - name: Get the tag name | |
| id: tagName | |
| if: startsWith(github.ref, 'refs/tags') | |
| uses: olegtarasov/get-tag@v2.1.4 | |
| - name: Create a new release | |
| if: startsWith(github.ref, 'refs/tags') | |
| uses: ncipollo/release-action@v1 | |
| with: | |
| allowUpdates: true | |
| artifacts: dist/*.tar.gz,dist/*.whl | |
| draft: true | |
| name: Smart Meter Data Collector ${{ steps.tagName.outputs.tag }} | |
| omitBody: true | |
| omitBodyDuringUpdate: true | |
| omitNameDuringUpdate: true | |
| omitPrereleaseDuringUpdate: true | |
| token: ${{ secrets.GITHUB_TOKEN }} |