Skip to content

Commit 3f90197

Browse files
committed
Change release process to use GitHub actions
1 parent 16178f1 commit 3f90197

File tree

6 files changed

+38
-110
lines changed

6 files changed

+38
-110
lines changed

.github/workflows/release.yml

Lines changed: 37 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -21,35 +21,52 @@ jobs:
2121
with:
2222
python-version: ${{ matrix.python-version }}
2323

24-
- uses: actions/cache@v2
24+
- name: "Calver calculate version"
25+
uses: StephaneBour/actions-calver@master
26+
id: calver
2527
with:
26-
path: ~/.cache/pip
27-
# This is like the example but we use ``*requirements.txt`` rather
28-
# than ``requirements.txt`` because we have multiple requirements
29-
# files.
30-
key: ${{ runner.os }}-pip-${{ hashFiles('**/*requirements.txt') }}
31-
restore-keys: |
32-
${{ runner.os }}-pip-
33-
34-
- name: "Install dependencies"
35-
run: |
36-
python -m pip install --upgrade pip setuptools wheel
37-
# We use '--ignore-installed' to avoid GitHub's cache which can cause
38-
# issues - we have seen packages from this cache cause trouble with
39-
# pip-extra-reqs.
40-
python -m pip install --ignore-installed --upgrade --editable .[dev]
28+
date_format: "%Y.%m.%d"
29+
release: false
30+
env:
31+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4132

42-
- name: "Publish a release"
33+
- name: "Update changelog"
34+
uses: jacobtomlinson/gha-find-replace@v2
4335
env:
44-
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
45-
run: |
46-
python admin/release.py
36+
NEXT_VERSION: ${{ steps.calver.outputs.release }}
37+
with:
38+
find: "Next\n----"
39+
replace: "Next\n----\n\n${{ env.NEXT_VERSION }}\n------------"
40+
include: "CHANGELOG.rst"
41+
regex: false
42+
43+
- uses: stefanzweifel/git-auto-commit-action@v4
44+
id: commit
45+
with:
46+
commit_message: Bump CHANGELOG
47+
48+
- name: Bump version and push tag
49+
id: tag_version
50+
uses: mathieudutour/github-tag-action@v6.0
51+
with:
52+
github_token: ${{ secrets.GITHUB_TOKEN }}
53+
custom_tag: ${{ steps.calver.outputs.release }}
54+
tag_prefix: ""
55+
commit_sha: ${{ steps.commit.outputs.commit_hash }}
56+
57+
- name: Create a GitHub release
58+
uses: ncipollo/release-action@v1
59+
with:
60+
tag: ${{ steps.tag_version.outputs.new_tag }}
61+
name: Release ${{ steps.tag_version.outputs.new_tag }}
62+
body: ${{ steps.tag_version.outputs.changelog }}
4763

4864
- name: Build a binary wheel and a source tarball
4965
run: |
5066
# Checkout the latest tag - the one we just created.
5167
git fetch --tags
5268
git checkout $(git describe --tags $(git rev-list --tags --max-count=1))
69+
python -m pip install build
5370
python -m build --sdist --wheel --outdir dist/ .
5471
5572
- name: Publish distribution 📦 to PyPI

admin/__init__.py

Lines changed: 0 additions & 3 deletions
This file was deleted.

admin/release.py

Lines changed: 0 additions & 83 deletions
This file was deleted.

lint.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ pip-missing-reqs:
5050

5151
.PHONY: pylint
5252
pylint:
53-
pylint *.py src/ tests/ admin/ docs/ ci/
53+
pylint *.py src/ tests/ docs/ ci/
5454

5555
.PHONY: pyroma
5656
pyroma:

pyproject.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,6 @@ ignore = [
123123
"readthedocs.yaml",
124124
".style.yapf",
125125
".travis.yml",
126-
"admin",
127-
"admin/**",
128126
"CHANGELOG.rst",
129127
"CODE_OF_CONDUCT.rst",
130128
"CONTRIBUTING.rst",

requirements/dev-requirements.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ mypy==0.910 # Type checking
1919
pip_check_reqs==2.3.2
2020
pydocstyle==6.1.1 # Lint docstrings
2121
pyenchant==3.2.2 # Bindings for a spellchecking sytem
22-
pygithub==1.55
2322
pylint==2.12.2 # Lint
2423
pyroma==3.2 # Packaging best practices checker
2524
pytest-cov==3.0.0 # Measure code coverage

0 commit comments

Comments
 (0)