-
Notifications
You must be signed in to change notification settings - Fork 74
53 lines (42 loc) · 1.5 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:
# NOTE: PR trigger is to ensure changes do not break packaging.
pull_request:
release:
types: [released]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build-n-publish:
name: Build and publish Python 🐍 distributions 📦 to PyPI
runs-on: ubuntu-latest
if: github.repository == 'spacetelescope/jdaviz'
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
- uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
with:
python-version: '3.10'
- name: Install python-build and twine
run: python -m pip install build "twine>=3.3" "importlib_metadata!=8.0.0"
- name: Build package
run: python -m build --sdist --wheel .
- name: List result
run: ls -l dist
- name: Check dist
run: python -m twine check --strict dist/*
- name: Test package
run: |
cd ..
python -m venv testenv
testenv/bin/pip install pytest pytest-astropy pytest-tornasync jdaviz/dist/*.whl
testenv/bin/python -c "import jdaviz; jdaviz.test(remote_data=True)"
# NOTE: Do not run this part for PR testing.
- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@fb13cb306901256ace3dab689990e13a5550ffaa # v1.11.0
if: github.event_name != 'pull_request'
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}