From 14b3e7fb96ccb86360153242f7649eb5d360edb5 Mon Sep 17 00:00:00 2001 From: Lucas de Sousa Rosa Date: Wed, 29 Nov 2023 22:56:35 -0300 Subject: [PATCH] Add GH actions to create releases when tags are pushed and deploy when released. --- .github/workflows/pypi-publish.yml | 35 ++++++++++------------------ .github/workflows/tag-to-release.yml | 26 +++++++++++++++++++++ 2 files changed, 38 insertions(+), 23 deletions(-) create mode 100644 .github/workflows/tag-to-release.yml diff --git a/.github/workflows/pypi-publish.yml b/.github/workflows/pypi-publish.yml index 1909a32..14ca1f8 100644 --- a/.github/workflows/pypi-publish.yml +++ b/.github/workflows/pypi-publish.yml @@ -1,28 +1,17 @@ -name: Deploy to PyPI - +name: Build and deploy with poetry on: release: - types: [created] - + types: [published] jobs: - deploy: + build_and_publish: runs-on: ubuntu-latest - env: - POETRY_VIRTUALENVS_CREATE: "false" steps: - - uses: actions/checkout@v3 - - - name: Install poetry with bumpversion plugin - run: | - pipx install poetry - pipx inject poetry poetry-bumpversion - - - name: Build the package and bump version - run: | - poetry version ${{ github.ref_name }} - poetry build - - - name: Publish to PyPI - run: | - poetry config pypi-token.pypi ${{ secrets.PYPI_TOKEN }} - poetry publish --repository test-pypi \ No newline at end of file + - uses: actions/checkout@v4 + + - name: Build and publish to PyPI + uses: JRubics/poetry-publish@v1.17 + with: + repository_name: "test-pypi" + repository_url: "https://test.pypi.org/legacy/" + pypi_token: ${{ secrets.PYPI_TOKEN }} + ignore_dev_requirements: "yes" \ No newline at end of file diff --git a/.github/workflows/tag-to-release.yml b/.github/workflows/tag-to-release.yml new file mode 100644 index 0000000..3d31857 --- /dev/null +++ b/.github/workflows/tag-to-release.yml @@ -0,0 +1,26 @@ +on: + push: + tags: + - 'v*.*.*' + +name: Create releases on tag push + +jobs: + build: + name: Create release + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Create release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ github.ref }} + release_name: Release ${{ github.ref }} + body: | + This is an automated release. + draft: false + prerelease: false \ No newline at end of file