Skip to content

Commit ee8b91e

Browse files
authored
Add auto publish workflow
[ci skip]
1 parent 0565717 commit ee8b91e

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

.github/workflows/publish.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Release
2+
3+
on:
4+
pull_request:
5+
push:
6+
tags:
7+
- '*'
8+
9+
jobs:
10+
build-n-publish:
11+
name: Build and publish Python 🐍 distributions 📦 to PyPI
12+
runs-on: ubuntu-latest
13+
if: ((github.event_name == 'push' && startsWith(github.ref, 'refs/tags')) || contains(github.event.pull_request.labels.*.name, 'Build wheels'))
14+
15+
steps:
16+
- uses: actions/checkout@v2
17+
with:
18+
fetch-depth: 0
19+
- uses: actions/setup-python@v2
20+
with:
21+
python-version: 3.8
22+
23+
- name: Install python-build and twine
24+
run: python -m pip install pip build "twine>=3.3" -U
25+
26+
- name: Build package
27+
run: python -m build --sdist --wheel .
28+
29+
- name: List result
30+
run: ls -l dist
31+
32+
- name: Check long_description
33+
run: python -m twine check --strict dist/*
34+
35+
- name: Test package
36+
run: |
37+
cd ..
38+
python -m venv testenv
39+
testenv/bin/pip install pytest pytest-arraydiff/dist/*.whl
40+
testenv/bin/pytest pytest-arraydiff/tests --arraydiff
41+
42+
- name: Publish distribution 📦 to PyPI
43+
if: startsWith(github.ref, 'refs/tags')
44+
uses: pypa/gh-action-pypi-publish@release/v1
45+
with:
46+
user: __token__
47+
password: ${{ secrets.pypi_password }}

0 commit comments

Comments
 (0)