v0.2.3 — polished README, release assets #5
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 to PyPI | |
| # Publishes bitchat-cli to PyPI when a GitHub Release is published. | |
| # Uses PyPI Trusted Publishing (OIDC) — no API token or secret is stored in | |
| # the repo. The release tag should match the version in | |
| # bitchat_cli/__init__.py (e.g. tag v0.2.0 for version 0.2.0). | |
| on: | |
| release: | |
| types: [published] | |
| permissions: | |
| contents: read | |
| jobs: | |
| test: | |
| name: Protocol self-test | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.x" | |
| - name: Install test dependency | |
| run: python -m pip install --upgrade cryptography | |
| - name: Run offline self-tests | |
| run: python selftest.py | |
| build: | |
| name: Build distribution | |
| needs: test | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.x" | |
| - name: Install build backend | |
| run: python -m pip install --upgrade build | |
| - name: Build sdist and wheel | |
| run: python -m build | |
| - name: Upload distribution artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: dist | |
| path: dist/ | |
| publish: | |
| name: Publish to PyPI | |
| needs: build | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: pypi | |
| url: https://pypi.org/project/bitchat-cli/ | |
| permissions: | |
| id-token: write # required for Trusted Publishing (OIDC) | |
| contents: write # required to attach the built artifacts to the release | |
| steps: | |
| - name: Download distribution artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: dist | |
| path: dist/ | |
| - name: Publish to PyPI | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| with: | |
| # No-op (success) if this version is already on PyPI, instead of failing. | |
| skip-existing: true | |
| - name: Attach the wheel and sdist to the GitHub Release | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| run: >- | |
| gh release upload "${{ github.event.release.tag_name }}" | |
| dist/*.whl dist/*.tar.gz | |
| --clobber --repo "${{ github.repository }}" |