diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 00000000..1e6149de --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,39 @@ +--- +name: Publish to PyPI + +"on": + push: + branches: + - 'master' + workflow_dispatch: + +permissions: + contents: read + +jobs: + build: + + runs-on: ubuntu-latest + + environment: release + permissions: + id-token: write + + steps: + - uses: actions/checkout@v3 + - name: Set up Python + uses: actions/setup-python@v6 + with: + python-version: '3.x' + cache: 'pip' + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install hatch + - name: Build package + run: hatch build + - name: Test package + run: hatch run test + - name: Publish package distributions to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + if: github.event_name == 'push' && startsWith(github.ref, 'refs/heads/2') diff --git a/.gitignore b/.gitignore index 9f196a82..dd6140b0 100644 --- a/.gitignore +++ b/.gitignore @@ -24,3 +24,4 @@ ChangeLog testtools/_version.py man/testtools.1 man +.mypy_cache/