From 0b75bda5454b99baf9e22bc9e6e5e41932826358 Mon Sep 17 00:00:00 2001 From: Jillian Date: Mon, 24 Jul 2023 12:51:41 +0930 Subject: [PATCH] build: publish openedx-learning to pypi (#65) build: publish openedx-learning to pypi --- .github/workflows/ci.yml | 2 +- .github/workflows/pypi-publish.yml | 30 ++++++++++++++++++++++++++++++ tox.ini | 8 ++++++++ 3 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/pypi-publish.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 43211145..953124f4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,7 +16,7 @@ jobs: matrix: os: [ubuntu-latest] # Add macos-latest later? python-version: ['3.8'] - toxenv: ["py38-django32", "py38-django42"] + toxenv: ["py38-django32", "py38-django42", "package"] # We're only testing against MySQL 8 right now because 5.7 is # incompatible with Djagno 4.2. We'd have to make the tox.ini file more # complicated than it's worth given the short expected shelf-life of diff --git a/.github/workflows/pypi-publish.yml b/.github/workflows/pypi-publish.yml new file mode 100644 index 00000000..325ea8ce --- /dev/null +++ b/.github/workflows/pypi-publish.yml @@ -0,0 +1,30 @@ +name: Publish package to PyPI + +on: + push: + tags: + - '*' + +jobs: + push: + runs-on: ubuntu-20.04 + + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: setup python + uses: actions/setup-python@v4 + with: + python-version: 3.8 + + - name: Install pip + run: pip install -r requirements/pip.txt + + - name: Build package + run: python setup.py sdist bdist_wheel + + - name: Publish to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + with: + user: __token__ + password: ${{ secrets.PYPI_UPLOAD_TOKEN }} diff --git a/tox.ini b/tox.ini index ad8e2cb5..4a0100cb 100644 --- a/tox.ini +++ b/tox.ini @@ -88,3 +88,11 @@ deps = -r{toxinidir}/requirements/test.txt commands = code_annotations django_find_annotations --config_file .pii_annotations.yml --lint --report --coverage + +[testenv:package] +deps = + build + twine +commands = + python -m build + twine check dist/*