Skip to content

Commit

Permalink
feat: add pypi deployment worklow
Browse files Browse the repository at this point in the history
  • Loading branch information
Yelinz committed Apr 20, 2023
1 parent 7827984 commit 8c341cc
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 6 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/pypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: PyPI

on:
release:
types: [created]

jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Install poetry
run: pipx install poetry

- name: Setup python
uses: actions/setup-python@v4
with:
python-version: "3.8"
cache: "poetry"

- name: Install dependencies
run: |
python -m pip install -U twine
poetry install
- name: Build package
run: poetry build

- name: Upload to PyPI
run: twine upload dist/*
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
TWINE_NON_INTERACTIVE: true
5 changes: 5 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
include CHANGELOG.md
include LICENSE
recursive-include LICENSES *
global-exclude *.py[co]
global-exclude __pycache__
2 changes: 1 addition & 1 deletion alexandria/settings/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
from .django import *
from .django import * # noqa
10 changes: 8 additions & 2 deletions alexandria/settings/alexandria.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
"""
This settings module only contains alexandria specific settings.
It's imported by the main alexandria settings and is intended to also be used by third party
applications integrating alexandria.
"""

import os
import re

import environ

env = environ.Env()
django_root = environ.Path(__file__) - 2
django_root = environ.Path(__file__) - 3

ENV_FILE = env.str("ENV_FILE", default=django_root(".env"))
if os.path.exists(ENV_FILE):
Expand Down
9 changes: 6 additions & 3 deletions alexandria/settings/django.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
from django.conf import global_settings

from .alexandria import * # noqa
from .alexandria import default, django_root, env, environ

from .alexandria import default, env, environ

SECRET_KEY = env.str("SECRET_KEY", default=default("uuuuuuuuuu"))
DEBUG = env.bool("DEBUG", default=default(True, False))
Expand All @@ -22,7 +21,7 @@
"alexandria.core.apps.DefaultConfig",
]

if ENV == "dev":
if ENV == "dev": # noqa
INSTALLED_APPS.append("django_extensions")

MIDDLEWARE = [
Expand Down Expand Up @@ -118,6 +117,10 @@ def parse_languages(languages):
"TEST_REQUEST_DEFAULT_FORMAT": "vnd.api+json",
}

JSON_API_FORMAT_FIELD_NAMES = "dasherize"
JSON_API_FORMAT_TYPES = "dasherize"
JSON_API_PLURALIZE_TYPES = True

# Anonymous writing
ALLOW_ANONYMOUS_WRITE = env.bool("ALLOW_ANONYMOUS_WRITE", default=False)

Expand Down

0 comments on commit 8c341cc

Please sign in to comment.