mirror of
https://github.com/Hopiu/django-markdownx.git
synced 2026-03-17 05:50:23 +00:00
90 lines
2.7 KiB
YAML
90 lines
2.7 KiB
YAML
# This workflows will upload a Python Package using Twine when a release is created
|
|
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries
|
|
|
|
name: Upload Python Package to PyPI
|
|
|
|
on:
|
|
release:
|
|
types: [created]
|
|
|
|
jobs:
|
|
test:
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
strategy:
|
|
matrix:
|
|
os: [ macos-latest, ubuntu-latest, windows-latest ]
|
|
python-version: [ 3.7, 3.8, 3.9, 3.10 ]
|
|
django-version: [3.0.*, 3.1.*, 3.2.*, 4.0.*]
|
|
|
|
steps:
|
|
- uses: actions/checkout@v2.3.2
|
|
- name: Set up Python ${{ matrix.python-version }}
|
|
uses: actions/setup-python@v2
|
|
with:
|
|
python-version: ${{ matrix.python-version }}
|
|
- name: Install dependencies
|
|
run: |
|
|
python dev.py -no-container
|
|
pip install -q Django==${{ matrix.django-version }}
|
|
python -m pip install --upgrade pip
|
|
python setup.py install
|
|
- name: Test with pytest
|
|
run: |
|
|
python runtests.py
|
|
|
|
deploy:
|
|
needs: test
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- uses: actions/checkout@v2.3.2
|
|
- name: Set up Python
|
|
uses: actions/setup-python@v2
|
|
with:
|
|
python-version: '3.8'
|
|
- name: Install dependencies
|
|
run: |
|
|
python -m pip install --upgrade pip
|
|
pip install setuptools wheel twine
|
|
- name: Build and publish
|
|
env:
|
|
TWINE_USERNAME: __token__
|
|
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
|
|
run: |
|
|
python setup.py sdist bdist_wheel
|
|
twine upload dist/*
|
|
|
|
docs:
|
|
needs:
|
|
- test
|
|
- deploy
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v2.3.2
|
|
run: |
|
|
python dev.py --with-docs
|
|
mkdocs build
|
|
|
|
- name: Commit documentation changes
|
|
run: |
|
|
git clone https://github.com/publichealthengland/coronavirus-dashboard-api-python-sdk.git --branch gh-pages --single-branch gh-pages
|
|
cp -r docs/* gh-pages/
|
|
cd gh-pages
|
|
VERSION=$(python setup.py -V)
|
|
echo ${VERSION} >> version
|
|
> .nojekyll
|
|
git config --local user.email "action@github.com"
|
|
git config --local user.name "GitHub Action"
|
|
git add .
|
|
git commit -m "Update documentations" -a || true
|
|
echo "Documentations for v${VERSION} has been deployed."
|
|
# The above command will fail if no changes were present, so we ignore
|
|
# the return code.
|
|
|
|
- name: Push changes
|
|
uses: ad-m/github-push-action@master
|
|
with:
|
|
branch: gh-pages
|
|
directory: gh-pages
|
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|