Skip to content

Commit 8828d6b

Browse files
authored
feat(CI/CD): Add GitHub Action workflow to publish to PyPI (#224)
* feat(CI/CD): Add GitHub Action workflow to publish to PyPI * fix: Used isinstance instead of type() to validate type instance * feat: Use PyPI Trusted Publisher
1 parent beb8415 commit 8828d6b

File tree

2 files changed

+61
-13
lines changed

2 files changed

+61
-13
lines changed

.github/workflows/publish.yml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: Publish to PyPI
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
permissions:
8+
contents: read
9+
10+
jobs:
11+
build:
12+
strategy:
13+
matrix:
14+
os: [ubuntu-latest, macos-latest, windows-latest]
15+
python: ["3.7", "3.8", "3.9", "3.10", "3.11"]
16+
runs-on: ${{ matrix.os }}
17+
steps:
18+
- uses: actions/checkout@v3
19+
- name: Set up Python ${{ matrix.python }}
20+
uses: actions/setup-python@v3
21+
with:
22+
python-version: ${{ matrix.python }}
23+
- name: Lint with flake8
24+
run: |
25+
python -m pip install flake8
26+
flake8 graphene_mongo --count --show-source --statistics
27+
- name: Install dependencies
28+
run: |
29+
python -m pip install poetry
30+
poetry config virtualenvs.create false
31+
poetry install --with dev
32+
- name: Run Tests
33+
run: make test
34+
- name: Build Package
35+
run: |
36+
poetry build
37+
38+
publish:
39+
needs: build
40+
runs-on: ubuntu-latest
41+
permissions:
42+
# IMPORTANT: this permission is mandatory for trusted publishing
43+
id-token: write
44+
steps:
45+
- uses: actions/checkout@v3
46+
- name: Set up Python
47+
uses: actions/setup-python@v3
48+
with:
49+
python-version: '3.x'
50+
- name: Install dependencies
51+
run: |
52+
python -m pip install --upgrade pip
53+
pip install poetry
54+
- name: Build package
55+
run: |
56+
poetry build
57+
- name: Build package
58+
run: |
59+
poetry build
60+
- name: Publish package distributions to PyPI
61+
uses: pypa/gh-action-pypi-publish@release/v1

.travis.yml

Lines changed: 0 additions & 13 deletions
This file was deleted.

0 commit comments

Comments
 (0)