From 5db65626a8ccbbf220d3b4c24d96da1c1fb3ff74 Mon Sep 17 00:00:00 2001 From: Daniel Gafni Date: Thu, 18 Apr 2024 19:02:38 +0200 Subject: [PATCH] add release to ci --- .github/workflows/{check.yml => CI.yml} | 47 +++++++++++++++++++++++++ .github/workflows/release.yml | 38 -------------------- 2 files changed, 47 insertions(+), 38 deletions(-) rename .github/workflows/{check.yml => CI.yml} (61%) delete mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/check.yml b/.github/workflows/CI.yml similarity index 61% rename from .github/workflows/check.yml rename to .github/workflows/CI.yml index 3dc71fd..362ad2c 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/CI.yml @@ -1,6 +1,18 @@ name: QA & Tests + on: + workflow_dispatch: push: + release: + types: + - created + # Sequence of patterns matched against refs/tags + tags: + - 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10 + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true jobs: test: @@ -76,3 +88,38 @@ jobs: run: poetry install --all-extras --sync - name: Run pre-commit hooks run: pre-commit run --all-files + + qa_success: + name: QA Success + needs: [ test, lint ] + runs-on: ubuntu-latest + steps: + - name: Success + run: echo "QA Succeeded!" + + publish: + needs: qa_success + if: contains(github.ref, 'refs/tags/') + name: Publish to PyPI + runs-on: ubuntu-latest + steps: + - name: Setup Python + uses: actions/setup-python@v2 + with: + python-version: 3.9 + - uses: actions/checkout@v2 + - name: Install and configure Poetry + uses: snok/install-poetry@v1 + with: + version: 1.8.2 + virtualenvs-create: false + virtualenvs-in-project: false + installer-parallel: true + - name: Install poetry-dynamic-versioning + run: poetry self add poetry-dynamic-versioning@1.2.0 + - name: Publish to PyPI + env: + PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }} + run: | + poetry config pypi-token.pypi $PYPI_TOKEN + poetry publish --build diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index 484bef3..0000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,38 +0,0 @@ -name: Release -on: - release: - types: - - created - # Sequence of patterns matched against refs/tags - tags: - - 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10 -jobs: - # GitHub Actions don't support requiring jobs from another workflow, and `needs` doesn't work well with matrix, - # so this workflow doesn't have testing included. Take care and only create releases from commits with the `check` - # workflow passing. - publish: - name: Publish to PyPI - strategy: - fail-fast: false - runs-on: ubuntu-latest - steps: - - name: Setup Python - uses: actions/setup-python@v2 - with: - python-version: 3.9 - - uses: actions/checkout@v2 - - name: Install and configure Poetry - uses: snok/install-poetry@v1 - with: - version: 1.4.2 - virtualenvs-create: false - virtualenvs-in-project: false - installer-parallel: true - - name: Install poetry-dynamic-versioning - run: poetry self add poetry-dynamic-versioning@0.21.4 - - name: Publish to PyPI - env: - PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }} - run: | - poetry config pypi-token.pypi $PYPI_TOKEN - poetry publish --build