|
1 |
| -name: Publish to PyPI |
| 1 | +name: Release |
2 | 2 |
|
3 | 3 | on:
|
| 4 | + workflow_dispatch: |
4 | 5 | release:
|
5 | 6 | types: [released]
|
6 | 7 |
|
| 8 | +concurrency: |
| 9 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 10 | + cancel-in-progress: true |
| 11 | + |
7 | 12 | jobs:
|
8 |
| - build: |
9 |
| - name: Publish release to PyPI |
10 |
| - env: |
11 |
| - PYPI_USERNAME_STSCI_MAINTAINER: ${{ secrets.PYPI_USERNAME_STSCI_MAINTAINER }} |
12 |
| - PYPI_PASSWORD_STSCI_MAINTAINER: ${{ secrets.PYPI_PASSWORD_STSCI_MAINTAINER }} |
13 |
| - PYPI_USERNAME_OVERRIDE: ${{ secrets.PYPI_USERNAME_OVERRIDE }} |
14 |
| - PYPI_PASSWORD_OVERRIDE: ${{ secrets.PYPI_PASSWORD_OVERRIDE }} |
15 |
| - PYPI_TEST: ${{ secrets.PYPI_TEST }} |
16 |
| - INDEX_URL_OVERRIDE: ${{ secrets.INDEX_URL_OVERRIDE }} |
17 |
| - runs-on: ubuntu-latest |
18 |
| - steps: |
19 |
| - |
20 |
| - # Check out the commit containing this workflow file. |
21 |
| - - name: checkout repo |
22 |
| - uses: actions/checkout@v4 |
23 |
| - with: |
24 |
| - # Number of commits to fetch. 0 indicates all history for all branches and tags. |
25 |
| - # Default: 1 |
26 |
| - fetch-depth: '0' |
27 |
| - |
28 |
| - - name: custom action |
29 |
| - uses: spacetelescope/action-publish_to_pypi@master |
30 |
| - id: custom_action_0 |
| 13 | + build-n-publish: |
| 14 | + name: Build and publish Python 🐍 distributions 📦 to PyPI |
| 15 | + runs-on: ubuntu-latest |
| 16 | + if: github.repository == 'spacetelescope/stginga' |
| 17 | + environment: |
| 18 | + name: release |
| 19 | + url: https://pypi.org/p/stginga |
| 20 | + permissions: |
| 21 | + id-token: write # IMPORTANT: mandatory for trusted publishing |
| 22 | + |
| 23 | + steps: |
| 24 | + - uses: actions/checkout@v4 |
| 25 | + with: |
| 26 | + fetch-depth: 0 |
| 27 | + |
| 28 | + - uses: actions/setup-python@v4 |
| 29 | + with: |
| 30 | + python-version: '3.x' |
| 31 | + |
| 32 | + - name: Install python-build and twine |
| 33 | + run: python -m pip install build "twine>=3.3" |
| 34 | + |
| 35 | + - name: Build package |
| 36 | + run: python -m build --sdist --wheel . |
| 37 | + |
| 38 | + - name: List result |
| 39 | + run: ls -l dist |
| 40 | + |
| 41 | + - name: Check dist |
| 42 | + run: python -m twine check --strict dist/* |
| 43 | + |
| 44 | + - name: Test package |
| 45 | + run: | |
| 46 | + cd .. |
| 47 | + python -m venv testenv |
| 48 | + testenv/bin/pip install pytest-astropy ci-watson stginga_refactor/dist/*.whl |
| 49 | + testenv/bin/python -c "import stginga; stginga.test()" |
| 50 | +
|
| 51 | + - name: Publish distribution 📦 to PyPI |
| 52 | + if: github.event_name == 'release' |
| 53 | + uses: pypa/gh-action-pypi-publish@release/v1 |
0 commit comments