From a6b6c68c454fdcc0d80d5d6225bed2c2c66ecf04 Mon Sep 17 00:00:00 2001 From: Abhinand C Date: Sat, 5 Aug 2023 23:44:45 +0530 Subject: [PATCH] feat(CI/CD): Add GitHub Action workflow to publish to PyPI --- .github/workflows/publish.yml | 55 +++++++++++++++++++++++++++++++++++ .travis.yml | 13 --------- 2 files changed, 55 insertions(+), 13 deletions(-) create mode 100644 .github/workflows/publish.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 00000000..9c4422e0 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,55 @@ +name: Publish to PyPI + +on: + release: + types: [published] + +permissions: + contents: read + +jobs: + build: + strategy: + matrix: + os: [ubuntu-latest, macos-latest, windows-latest] + python: ["3.7", "3.8", "3.9", "3.10", "3.11"] + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v3 + - name: Set up Python ${{ matrix.python }} + uses: actions/setup-python@v3 + with: + python-version: ${{ matrix.python }} + - name: Lint with flake8 + run: | + python -m pip install flake8 + flake8 graphene_mongo --count --show-source --statistics + - name: Install dependencies + run: | + python -m pip install poetry + poetry config virtualenvs.create false + poetry install --with dev + - name: Run Tests + run: make test + - name: Build Package + run: | + poetry build + + publish: + needs: build + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - name: Set up Python + uses: actions/setup-python@v3 + with: + python-version: '3.x' + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install poetry + - name: Build & Release package + run: | + poetry config pypi-token.pypi ${{ secrets.PYPI_API_TOKEN }} + poetry publish --build \ No newline at end of file diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 72d6825d..00000000 --- a/.travis.yml +++ /dev/null @@ -1,13 +0,0 @@ -language: python -python: - - "2.7" - - "3.4" - - "3.5" - - "3.6" - - "3.8" -install: - pip install -r requirements.txt -script: make test -after_success: - - coveralls -