From 3e016560f135a89f3df881beeaa257a99b4d6c1a Mon Sep 17 00:00:00 2001 From: Alessandro Molina Date: Tue, 12 Nov 2024 21:19:46 +0000 Subject: [PATCH] Add release automation --- .github/workflows/release.yml | 37 +++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..d5651f8 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,37 @@ +name: Release + +on: + workflow_dispatch: + push: + # Pattern matched against refs/tags + tags: + - '*' + +jobs: + source_release: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Setup Python + uses: actions/setup-python@v4 + - name: Install build + run: python -m pip install build + - name: Make distribution + run: python -m build --sdist --wheel + - uses: actions/upload-artifact@v4 + with: + name: artifact-sdist + path: dist/* + - uses: softprops/action-gh-release@v1 + name: Create GitHub Release + if: startsWith(github.ref, 'refs/tags/') + with: + files: dist/* + - name: Publish to PyPI + if: startsWith(github.ref, 'refs/tags/') + run: | + python -m pip install --upgrade twine + python -m twine upload dist/* + env: + TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file