-
-
Notifications
You must be signed in to change notification settings - Fork 17
53 lines (44 loc) · 1.53 KB
/
publish.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
name: Release
on:
pull_request:
# We also want this workflow triggered if the 'Build all wheels' label is added
# or present when PR is updated
types:
- synchronize
- labeled
push:
tags:
- '*'
jobs:
build-n-publish:
name: Build and publish Python 🐍 distributions 📦 to PyPI
runs-on: ubuntu-latest
if: ((github.event_name == 'push' && startsWith(github.ref, 'refs/tags')) || contains(github.event.pull_request.labels.*.name, 'Build wheels'))
steps:
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
with:
fetch-depth: 0
- uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5.2.0
with:
python-version: "3.8"
- name: Install build dependencies
run: python -m pip install pip build "twine>=3.3" -U
- name: Build package
run: python -m build --sdist --wheel .
- name: List result
run: ls -l dist
- name: Check long_description
run: python -m twine check --strict dist/*
- name: Test package
run: |
cd ..
python -m venv testenv
testenv/bin/pip install pip -U
testenv/bin/pip install pytest sphinx-astropy/dist/*.whl
testenv/bin/pytest sphinx-astropy/sphinx_astropy
- name: Publish distribution 📦 to PyPI
if: startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@897895f1e160c830e369f9779632ebc134688e1b # v1.10.2
with:
user: __token__
password: ${{ secrets.pypi_password }}