Skip to content

Commit 82667b2

Browse files
committed
Add publish workflow
1 parent 3703265 commit 82667b2

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

.github/workflows/publish.yml

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

0 commit comments

Comments
 (0)