mirror of
https://github.com/Hopiu/django-markdownx.git
synced 2026-03-16 21:40:24 +00:00
Add GH Actions (#218)
* updates URLs to Django 4 pattern * Checks for Ajax request using `x-requested-with` header * housekeeping * housekeeping * adds zlib to windows runs * uses specific python version * updates git URL * disables testing on Windows * changes docs path * changes docs path * changes docs path * Update documentations * removes docs Co-authored-by: GitHub Action <action@github.com>
This commit is contained in:
parent
de7f21823f
commit
52c9a1e670
8 changed files with 52 additions and 29 deletions
12
.github/workflows/deploy_docs.yml
vendored
12
.github/workflows/deploy_docs.yml
vendored
|
|
@ -5,16 +5,16 @@ on:
|
|||
types: [ created ]
|
||||
|
||||
push:
|
||||
branches: [ master ]
|
||||
branches: [ master, actions ]
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Set up Python ${{ matrix.python-version }}
|
||||
- name: Set up Python 3.10
|
||||
uses: actions/setup-python@v2
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
python-version: "3.10"
|
||||
|
||||
- name: Checkout branch
|
||||
uses: actions/checkout@v2.3.2
|
||||
|
|
@ -26,8 +26,10 @@ jobs:
|
|||
|
||||
- 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/
|
||||
git clone https://github.com/neutronX/django-markdownx.git --branch gh-pages --single-branch gh-pages
|
||||
rm -rf gh-pages/docs
|
||||
mkdir gh-pages/docs
|
||||
cp -r docs/* gh-pages/docs/
|
||||
cd gh-pages
|
||||
VERSION=$(python setup.py -V)
|
||||
echo ${VERSION} >> version
|
||||
|
|
|
|||
18
.github/workflows/python-publish.yml
vendored
18
.github/workflows/python-publish.yml
vendored
|
|
@ -10,11 +10,18 @@ jobs:
|
|||
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ macos-latest, ubuntu-latest, windows-latest ]
|
||||
os: [ macos-latest, ubuntu-latest ]
|
||||
python-version: [ 3.9, "3.10" ]
|
||||
django-version: [ 3.1, 3.2, 4.0 ]
|
||||
|
||||
steps:
|
||||
- name: Install system dependencies (windows)
|
||||
if: matrix.os == 'windows-latest'
|
||||
uses: msys2/setup-msys2@v2
|
||||
with:
|
||||
update: true
|
||||
install: zlib
|
||||
|
||||
- uses: actions/checkout@v2.3.2
|
||||
|
||||
- name: Set up Python ${{ matrix.python-version }}
|
||||
|
|
@ -39,14 +46,17 @@ jobs:
|
|||
|
||||
steps:
|
||||
- uses: actions/checkout@v2.3.2
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v2
|
||||
with:
|
||||
python-version: '3.8'
|
||||
python-version: '3.10'
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install setuptools wheel twine
|
||||
|
||||
- name: Build and publish
|
||||
env:
|
||||
TWINE_USERNAME: __token__
|
||||
|
|
@ -69,7 +79,9 @@ jobs:
|
|||
- 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/
|
||||
rm -rf gh-pages/docs
|
||||
mkdir gh-pages/docs
|
||||
cp -r docs/* gh-pages/docs/
|
||||
cd gh-pages
|
||||
VERSION=$(python setup.py -V)
|
||||
echo ${VERSION} >> version
|
||||
|
|
|
|||
13
.github/workflows/run-tests.yml
vendored
13
.github/workflows/run-tests.yml
vendored
|
|
@ -2,10 +2,10 @@ name: Python package
|
|||
|
||||
on:
|
||||
push:
|
||||
branches: [ master ]
|
||||
branches: [ master, actions ]
|
||||
|
||||
pull_request:
|
||||
branches: [ master ]
|
||||
branches: [ master, actions ]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
|
@ -13,11 +13,18 @@ jobs:
|
|||
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ macos-latest, ubuntu-latest, windows-latest ]
|
||||
os: [ macos-latest, ubuntu-latest ]
|
||||
python-version: [ 3.9, "3.10" ]
|
||||
django-version: [ 3.1, 3.2, 4.0 ]
|
||||
|
||||
steps:
|
||||
- name: Install system dependencies (windows)
|
||||
if: matrix.os == 'windows-latest'
|
||||
uses: msys2/setup-msys2@v2
|
||||
with:
|
||||
update: true
|
||||
install: zlib
|
||||
|
||||
- uses: actions/checkout@v2.3.2
|
||||
|
||||
- name: Set up Python ${{ matrix.python-version }}
|
||||
|
|
|
|||
0
.nojekyll
Normal file
0
.nojekyll
Normal file
|
|
@ -6,6 +6,6 @@ except ImportError:
|
|||
from .views import TestView
|
||||
|
||||
urlpatterns = [
|
||||
url(r'testview/$', TestView.as_view()),
|
||||
url(r'markdownx/$', include('markdownx.urls')),
|
||||
url(r'^testview/', TestView.as_view()),
|
||||
url(r'^markdownx/', include('markdownx.urls')),
|
||||
]
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ from django.views.generic.edit import CreateView
|
|||
|
||||
from .models import MyModel
|
||||
|
||||
|
||||
class TestView(CreateView):
|
||||
template_name = "test_view.html"
|
||||
model = MyModel
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ class ImageUploadView(BaseFormView):
|
|||
"""
|
||||
response = super(ImageUploadView, self).form_valid(form)
|
||||
|
||||
if self.request.is_ajax():
|
||||
if self.request.headers.get('x-requested-with') == 'XMLHttpRequest':
|
||||
image_path = form.save(commit=True)
|
||||
image_code = ''.format(image_path)
|
||||
return JsonResponse({'image_code': image_code})
|
||||
|
|
|
|||
1
version
Normal file
1
version
Normal file
|
|
@ -0,0 +1 @@
|
|||
4.0.0
|
||||
Loading…
Reference in a new issue