Skip to content

Commit 938cf8c

Browse files
committed
Begin work toward PyPI release automation
1 parent cf0f2c9 commit 938cf8c

File tree

2 files changed

+33
-10
lines changed

2 files changed

+33
-10
lines changed

.github/workflows/release.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- '*'
7+
8+
jobs:
9+
pypi-publish:
10+
if: startsWith(github.ref, 'refs/tags')
11+
name: Upload release to PyPI
12+
runs-on: ubuntu-latest
13+
environment:
14+
name: pypi
15+
url: https://pypi.org/p/cpppo
16+
permissions:
17+
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
18+
steps:
19+
- name: Checkout
20+
uses: actions/checkout@v3
21+
- name: Set up Python
22+
uses: actions/setup-python@v4
23+
- name: Build
24+
run: |
25+
python -m pip install --upgrade pip
26+
python -m pip install setuptools build wheel
27+
python -m build .
28+
- name: Publish package distributions to PyPI
29+
uses: pypa/gh-action-pypi-publish@release/v1

GNUmakefile

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#
44

55
# PY[3] is the target Python interpreter. It must have pytest installed.
6+
SHELL = /bin/bash
67

78
PY ?= python
89
PY2 ?= python2
@@ -74,7 +75,7 @@ PY_TEST=TZ=$(TZ) $(PY) -m pytest $(PYTESTOPTS)
7475
PY2TEST=TZ=$(TZ) $(PY2) -m pytest $(PYTESTOPTS)
7576
PY3TEST=TZ=$(TZ) $(PY3) -m pytest $(PYTESTOPTS)
7677

77-
.PHONY: all test clean upload FORCE
78+
.PHONY: all test clean FORCE
7879
all: help
7980

8081
help:
@@ -83,7 +84,6 @@ help:
8384
@echo " test Run unit tests under Python2/3 (no serial_test w/o 'make SERIAL_TEST=1 test')"
8485
@echo " install Install in /usr/local for Python2/3"
8586
@echo " clean Remove build artifacts"
86-
@echo " upload Upload new version to pypi (package maintainer only)"
8787
@echo
8888
@echo " virtualbox-* Manage VirtualBox virtual machine"
8989
@echo " vmware-* Manage VMWare Fusion virtual machine (recommended; requires license)"
@@ -115,7 +115,7 @@ pylint:
115115
# nix-venv-activate
116116
#
117117
# The default is the Python 3 crypto_licensing target in default.nix; choose
118-
# TARGET=cpppo_py2 to test under Python 2 (more difficult as time goes on). See default.nix for
118+
# TARGET=py27 to test under Python 2 (more difficult as time goes on). See default.nix for
119119
# other Python version targets.
120120
#
121121
nix-%:
@@ -169,12 +169,6 @@ install: $(WHEEL) FORCE
169169
install-%: # ...-dev, -tests
170170
$(PY3) -m pip install --upgrade -r requirements-$*.txt
171171

172-
# Support uploading a new version of cpppo to pypi. Must:
173-
# o advance __version__ number in cpppo/version.py
174-
# o log in to your pypi account (ie. for package maintainer only)
175-
176-
upload: clean
177-
$(PY3) setup.py sdist upload
178172

179173
clean:
180174
@rm -rf MANIFEST *.png build dist auto *.egg-info $(shell find . -name '*.pyc' -o -name '__pycache__' )
@@ -190,7 +184,7 @@ unit-%:
190184
#
191185
# venv: Create a Virtual Env containing the installed repo
192186
#
193-
.PHONY: venv venv-activate.sh venv-activate
187+
.PHONY: venv
194188
venv: $(VENV)
195189
@echo; echo "*** Activating $< VirtualEnv for Interactive $(SHELL)"
196190
@bash --init-file $</bin/activate -i

0 commit comments

Comments
 (0)