diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 000000000..85f4c0eb5 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,41 @@ +name: Release + +on: + push: + tags: ["*"] + +jobs: + build: + name: Build distribution + runs-on: ubuntu-latest + environment: + name: pypi + url: https://pypi.org/project/skmatter + permissions: + id-token: write + contents: write + + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: setup Python + uses: actions/setup-python@v5 + with: + python-version: "3.13" + - run: python -m pip install tox + - name: Build package + run: tox -e build + - name: Publish distribution to PyPI + if: startsWith(github.ref, 'refs/tags/v') + uses: pypa/gh-action-pypi-publish@release/v1 + - name: Publish to GitHub release + if: startsWith(github.ref, 'refs/tags/v') + uses: softprops/action-gh-release@v2 + with: + files: | + dist/*.tar.gz + dist/*.whl + prerelease: ${{ contains(github.ref, '-rc') }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}