Skip to content

Commit 6c5ede2

Browse files
authored
Feature/workflow release (#17)
* Add dry run for twine commands To test twine steps in Makefile and also in workflows we introduce a test on env var `PYPI_DRY_RUN`. * Add release workflow To test it first we let it run in `PYPI_DRY_RUN`.
1 parent 32d3480 commit 6c5ede2

File tree

2 files changed

+35
-2
lines changed

2 files changed

+35
-2
lines changed

.github/workflows/release.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Release Python Package
2+
3+
on:
4+
push:
5+
tags:
6+
- v[0-9]+\.[0-9]+\.[0-9]+
7+
8+
jobs:
9+
deploy:
10+
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- uses: actions/checkout@v2
15+
- name: Set up Python
16+
uses: actions/setup-python@v2
17+
with:
18+
python-version: '3.x'
19+
- name: Install dependencies
20+
run: |
21+
python -m pip install --upgrade pip
22+
pip install -r requirements-dev.txt
23+
- name: Build and publish
24+
env:
25+
PYPI_API_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
26+
PYPY_DRY_RUN: True
27+
run: make publish

Makefile

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@ ifdef PYPI_API_TOKEN
66
TWINE_OPTIONS += --username __token__ --password $(PYPI_API_TOKEN)
77
endif
88

9+
ifdef PYPI_DRY_RUN
10+
TWINE_CMD = echo twine
11+
else
12+
TWINE_CMD = twine
13+
endif
14+
915
default: help
1016

1117
help:
@@ -21,10 +27,10 @@ dist:
2127
python3 setup.py sdist bdist_wheel
2228

2329
check: dist
24-
twine check dist/*
30+
$(TWINE_CMD) check dist/*
2531

2632
publish: check
27-
twine upload $(TWINE_OPTIONS) dist/*
33+
$(TWINE_CMD) upload $(TWINE_OPTIONS) dist/*
2834

2935
clean:
3036
rm -rf build/

0 commit comments

Comments
 (0)