-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
56 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,53 @@ | ||
name: Publish to PyPI | ||
name: Release | ||
|
||
on: | ||
workflow_dispatch: | ||
release: | ||
types: [released] | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
build: | ||
name: Publish release to PyPI | ||
env: | ||
PYPI_USERNAME_STSCI_MAINTAINER: ${{ secrets.PYPI_USERNAME_STSCI_MAINTAINER }} | ||
PYPI_PASSWORD_STSCI_MAINTAINER: ${{ secrets.PYPI_PASSWORD_STSCI_MAINTAINER }} | ||
PYPI_USERNAME_OVERRIDE: ${{ secrets.PYPI_USERNAME_OVERRIDE }} | ||
PYPI_PASSWORD_OVERRIDE: ${{ secrets.PYPI_PASSWORD_OVERRIDE }} | ||
PYPI_TEST: ${{ secrets.PYPI_TEST }} | ||
INDEX_URL_OVERRIDE: ${{ secrets.INDEX_URL_OVERRIDE }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
|
||
# Check out the commit containing this workflow file. | ||
- name: checkout repo | ||
uses: actions/checkout@v4 | ||
with: | ||
# Number of commits to fetch. 0 indicates all history for all branches and tags. | ||
# Default: 1 | ||
fetch-depth: '0' | ||
|
||
- name: custom action | ||
uses: spacetelescope/action-publish_to_pypi@master | ||
id: custom_action_0 | ||
build-n-publish: | ||
name: Build and publish Python 🐍 distributions 📦 to PyPI | ||
runs-on: ubuntu-latest | ||
if: github.repository == 'spacetelescope/stginga' | ||
environment: | ||
name: release | ||
url: https://pypi.org/p/stginga | ||
permissions: | ||
id-token: write # IMPORTANT: mandatory for trusted publishing | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.x' | ||
|
||
- name: Install python-build and twine | ||
run: python -m pip install build "twine>=3.3" | ||
|
||
- 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-astropy ci-watson stginga_refactor/dist/*.whl | ||
testenv/bin/python -c "import stginga; stginga.test()" | ||
- name: Publish distribution 📦 to PyPI | ||
if: github.event_name == 'release' | ||
uses: pypa/gh-action-pypi-publish@release/v1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters