Skip to content

Commit

Permalink
Automated releases (#44)
Browse files Browse the repository at this point in the history
* Adding build/release action

* Split the build actions so that production builds only happen on release creation

* 1.0 time
  • Loading branch information
marksweb committed Nov 13, 2021
1 parent c7d2fc7 commit 4c6c2cf
Show file tree
Hide file tree
Showing 6 changed files with 83 additions and 17 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/publish-to-live-pypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Publish Python 🐍 distributions 📦 to pypi

on:
release:
types:
- created

jobs:
build-n-publish:
name: Build and publish Python 🐍 distributions 📦 to pypi
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Set up Python 3.9
uses: actions/setup-python@v1
with:
python-version: 3.9

- name: Install pypa/build
run: >-
python -m
pip install
build
--user
- name: Build a binary wheel and a source tarball
run: >-
python -m
build
--sdist
--wheel
--outdir dist/
.
- name: Publish distribution 📦 to PyPI
if: startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@master
with:
password: ${{ secrets.PYPI_API_TOKEN }}
35 changes: 35 additions & 0 deletions .github/workflows/publish-to-test-pypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Publish Python 🐍 distributions 📦 to TestPyPI

on: push

jobs:
build-n-publish:
name: Build and publish Python 🐍 distributions 📦 to TestPyPI
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Set up Python 3.9
uses: actions/setup-python@v1
with:
python-version: 3.9

- name: Install pypa/build
run: >-
python -m
pip install
build
--user
- name: Build a binary wheel and a source tarball
run: >-
python -m
build
--sdist
--wheel
--outdir dist/
.
- name: Publish distribution 📦 to Test PyPI
uses: pypa/gh-action-pypi-publish@master
with:
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository_url: https://test.pypi.org/legacy/
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,14 @@ Change Log
This document records all notable changes to [django-bleach](https://github.com/marksweb/django-bleach).
This project adheres to [Semantic Versioning](https://semver.org/).

[unreleased](https://github.com/marksweb/django-bleach/compare/0.9.0...master) changes
[unreleased](https://github.com/marksweb/django-bleach/compare/1.0.0...master) changes
-------------------------------------------------------------------------------------

Version 1.0.0
=============
###### 13-11-2021
Going to 1.0 is long overdue, especially considering SemVer.
* automated pypi releases via github actions
* pre-commit hooks
* python 3.10 support
* docs syntax highlighting [#38](https://github.com/marksweb/django-bleach/pull/38)
Expand Down
2 changes: 1 addition & 1 deletion django_bleach/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__author__ = "Tim Heap & Mark Walker"
__version__ = "0.9.0"
__version__ = "1.0.0"

VERSION = __version__.split(".")
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
# Minimum requirements for the build system to execute.
requires = ["setuptools", "wheel"] # PEP 508 specifications.
15 changes: 0 additions & 15 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,21 +55,6 @@ def find_variable(variable, *parts):
release = find_variable('__version__', 'django_bleach', '__init__.py')
version = release.rstrip('.')

if sys.argv[-1] == 'build':
os.system('python setup.py sdist bdist_wheel')
sys.exit()

if sys.argv[-1] == 'release':
os.system('twine upload -r django-bleach --skip-existing dist/*')
sys.exit()

if sys.argv[-1] == 'tag':
print("Tagging the version on github:")
os.system(f"git tag -a {version} -m 'version {version}'")
os.system("git push --tags")
sys.exit()


setup(
name=name,
version=version,
Expand Down

0 comments on commit 4c6c2cf

Please sign in to comment.