Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move badge from Travis-CI to GH actions #437

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Publish django-post_office

on:
push:
tags:
- '*'

jobs:
publish:
name: "Publish release"
runs-on: "ubuntu-latest"

environment:
name: deploy

strategy:
matrix:
python-version: ["3.9"]

steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install build --user
- name: Build 🐍 Python 📦 Package
run: python -m build --sdist --wheel --outdir dist/
- name: Publish 🐍 Python 📦 Package to PyPI
if: startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@master
with:
password: ${{ secrets.PYPI_API_TOKEN_POST_OFFICE }}
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@ jobs:

- name: Run Test
run: |
`which django-admin` test post_office --settings=post_office.test_settings --pythonpath=.
`which django-admin` test post_office --settings=post_office.test_settings --pythonpath=.
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,11 @@ will otherwise be stripped for security reasons.

## Installation

[![Build
Status](https://travis-ci.org/ui/django-post_office.png?branch=master)](https://travis-ci.org/ui/django-post_office) [![PyPI version](https://img.shields.io/pypi/v/django-post_office.svg)](https://pypi.org/project/django-post_office/) ![Software license](https://img.shields.io/pypi/l/django-post_office.svg)
[![Build Status](https://github.com/ui/django-post_office/actions/workflows/test.yml/badge.svg)](https://github.com/ui/django-post_office/actions)
[![PyPI](https://img.shields.io/pypi/pyversions/django-post_office.svg)]()
[![PyPI version](https://img.shields.io/pypi/v/django-post_office.svg)](https://pypi.python.org/pypi/django-post_office)
[![PyPI](https://img.shields.io/pypi/l/django-post_office.svg)]()

Install from PyPI (or [manually download from PyPI](http://pypi.python.org/pypi/django-post_office)):

```sh
pip install django-post_office
Expand Down Expand Up @@ -311,6 +312,7 @@ inlined images, use the following code snippet:

```python
from django.core.mail import EmailMultiAlternatives
from django.template.loader import get_template

subject, body = "Hello", "Plain text body"
from_email, to_email = "[email protected]", "[email protected]"
Expand All @@ -328,6 +330,7 @@ plain text body, use this code snippet:

```python
from django.core.mail import EmailMultiAlternatives
from django.template.loader import get_template

subject, from_email, to_email = "Hello", "[email protected]", "[email protected]"
template = get_template('email-template-name.html', using='post_office')
Expand Down
5 changes: 3 additions & 2 deletions post_office/tests/test_html_email.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,12 +148,13 @@ def test_email_change_view(self):
msg.send()

# check that in the Email's detail view, the message is rendered
self.assertEqual(Email.objects.count(), 1) # TODO: remove this
email = Email.objects.latest('id')
parts = email.email_message().message().walk()
part = next(parts)
self.assertEqual(part.get_content_type(), 'multipart/mixed')
self.assertIsInstance(part, SafeMIMEMultipart)
part = next(parts)
self.assertEqual(part.get_content_type(), 'text/html')
self.assertIsInstance(part, SafeMIMEText)
part = next(parts)
self.assertEqual(part.get_content_type(), 'image/png')
content_id = part['Content-Id'][1:33]
Expand Down