diff --git a/.github/workflows/publish-to-pypi.yaml b/.github/workflows/publish-to-pypi.yaml new file mode 100644 index 0000000..1a16e40 --- /dev/null +++ b/.github/workflows/publish-to-pypi.yaml @@ -0,0 +1,63 @@ +name: publish to PyPI + +on: + push: + tags: + - v* + workflow_dispatch: + +permissions: + contents: read + +jobs: + build: + name: Build distribution + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v6 + + - name: Set up Python + uses: actions/setup-python@v6 + with: + python-version: "3.x" + + - name: install flake8 + run: | + pip install flake8 --user + + - name: run testsuite + run: | + make test + + - name: build source tarball + run: | + python3 setup.py sdist + + - name: Store the distribution packages + uses: actions/upload-artifact@v5 + with: + name: python-package-distributions + path: dist/ + + publish-to-pypi: + name: upload to PyPI + if: startsWith(github.ref, 'refs/tags/') + needs: + - build + runs-on: ubuntu-latest + environment: + name: pypi + url: https://pypi.org/p/editorconfig-checker + permissions: + id-token: write + steps: + + - name: Download all the dists + uses: actions/download-artifact@v6 + with: + name: python-package-distributions + path: dist/ + + - name: Publish distribution to PyPI + uses: pypa/gh-action-pypi-publish@release/v1