forked from extern/django-helpdesk
Merge pull request #1081 from django-helpdesk/pypi_release
Remove Python 2 dependency and Add Script for Pypi release
This commit is contained in:
commit
26628db7e0
57
.github/workflows/release_to_pypi.yml
vendored
Normal file
57
.github/workflows/release_to_pypi.yml
vendored
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
name: Publish ${package_name} to PyPI / GitHub
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags:
|
||||||
|
- "v*"
|
||||||
|
jobs:
|
||||||
|
build-n-publish:
|
||||||
|
name: Build and publish to PyPI
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout source
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Set up Python
|
||||||
|
uses: actions/setup-python@v2
|
||||||
|
with:
|
||||||
|
python-version: "3.x"
|
||||||
|
|
||||||
|
- name: Build source and wheel distributions
|
||||||
|
run: |
|
||||||
|
python -m pip install --upgrade build twine
|
||||||
|
python -m build
|
||||||
|
twine check --strict dist/*
|
||||||
|
- name: Publish distribution to PyPI
|
||||||
|
uses: pypa/gh-action-pypi-publish@master
|
||||||
|
with:
|
||||||
|
user: __token__
|
||||||
|
password: ${{ secrets.PYPI_API_TOKEN }}
|
||||||
|
|
||||||
|
- name: Create GitHub Release
|
||||||
|
id: create_release
|
||||||
|
uses: actions/create-release@v1
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
|
||||||
|
with:
|
||||||
|
tag_name: ${{ github.ref }}
|
||||||
|
release_name: ${{ github.ref }}
|
||||||
|
draft: false
|
||||||
|
prerelease: false
|
||||||
|
|
||||||
|
- name: Get Asset name
|
||||||
|
run: |
|
||||||
|
export PKG=$(ls dist/ | grep tar)
|
||||||
|
set -- $PKG
|
||||||
|
echo "name=$1" >> $GITHUB_ENV
|
||||||
|
- name: Upload Release Asset (sdist) to GitHub
|
||||||
|
id: upload-release-asset
|
||||||
|
uses: actions/upload-release-asset@v1
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
with:
|
||||||
|
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
||||||
|
asset_path: dist/${{ env.name }}
|
||||||
|
asset_name: ${{ env.name }}
|
||||||
|
asset_content_type: application/zip
|
@ -18,7 +18,6 @@ import itertools
|
|||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
from shutil import rmtree
|
from shutil import rmtree
|
||||||
import six
|
|
||||||
import sys
|
import sys
|
||||||
from tempfile import mkdtemp
|
from tempfile import mkdtemp
|
||||||
import typing
|
import typing
|
||||||
@ -399,7 +398,7 @@ class GetEmailParametricTemplate(object):
|
|||||||
if self.method == 'local':
|
if self.method == 'local':
|
||||||
with mock.patch('os.listdir') as mocked_listdir, \
|
with mock.patch('os.listdir') as mocked_listdir, \
|
||||||
mock.patch('helpdesk.email.isfile') as mocked_isfile, \
|
mock.patch('helpdesk.email.isfile') as mocked_isfile, \
|
||||||
mock.patch('builtins.open' if six.PY3 else '__builtin__.open', mock.mock_open(read_data=test_email)), \
|
mock.patch('builtins.open', mock.mock_open(read_data=test_email)), \
|
||||||
mock.patch('os.unlink'):
|
mock.patch('os.unlink'):
|
||||||
mocked_isfile.return_value = True
|
mocked_isfile.return_value = True
|
||||||
mocked_listdir.return_value = ['filename1', 'filename2']
|
mocked_listdir.return_value = ['filename1', 'filename2']
|
||||||
|
@ -10,7 +10,7 @@ from ..lib import format_time_spent
|
|||||||
from ..templated_email import send_templated_mail
|
from ..templated_email import send_templated_mail
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
from copy import deepcopy
|
from copy import deepcopy
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, time, timedelta
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.contrib.auth import get_user_model
|
from django.contrib.auth import get_user_model
|
||||||
from django.contrib.auth.decorators import user_passes_test
|
from django.contrib.auth.decorators import user_passes_test
|
||||||
|
@ -8,7 +8,6 @@ beautifulsoup4
|
|||||||
lxml
|
lxml
|
||||||
simplejson
|
simplejson
|
||||||
pytz
|
pytz
|
||||||
six
|
|
||||||
pinax_teams
|
pinax_teams
|
||||||
djangorestframework
|
djangorestframework
|
||||||
django-model-utils
|
django-model-utils
|
||||||
|
Loading…
Reference in New Issue
Block a user