From 18c2674395ca35c0c33309134f13efb5f047fa89 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Mon, 24 Jul 2023 17:17:00 -0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=93=A6=20chore(pre-release.yml):=20add=20?= =?UTF-8?q?pre-release=20workflow=20to=20automate=20the=20release=20proces?= =?UTF-8?q?s?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/pre-release.yml | 49 +++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 .github/workflows/pre-release.yml diff --git a/.github/workflows/pre-release.yml b/.github/workflows/pre-release.yml new file mode 100644 index 000000000..992c7130a --- /dev/null +++ b/.github/workflows/pre-release.yml @@ -0,0 +1,49 @@ +name: pre-release + +on: + pull_request: + types: + - closed + branches: + - dev + paths: + - "pyproject.toml" + +env: + POETRY_VERSION: "1.4.0" + +jobs: + if_release: + if: | + ${{ github.event.pull_request.merged == true }} + && ${{ contains(github.event.pull_request.labels.*.name, 'pre-release') }} + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Install poetry + run: pipx install poetry==$POETRY_VERSION + - name: Set up Python 3.10 + uses: actions/setup-python@v4 + with: + python-version: "3.10" + cache: "poetry" + - name: Build project for distribution + run: make build + - name: Check Version + id: check-version + run: | + echo version=$(poetry version --short) >> $GITHUB_OUTPUT + - name: Create Release + uses: ncipollo/release-action@v1 + with: + artifacts: "dist/*" + token: ${{ secrets.GITHUB_TOKEN }} + draft: false + generateReleaseNotes: true + tag: v${{ steps.check-version.outputs.version }} + commit: main + - name: Publish to PyPI + env: + POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_API_TOKEN }} + run: | + poetry publish