Backport PR #162 on branch v1.0.x (Bump the actions group across 1 directory with 2 updates) #327
Workflow file for this run
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
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 | |
permissions: | |
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing | |
if: github.repository == 'spacetelescope/lcviz' | |
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" | |
- 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 lcviz/dist/*.whl | |
testenv/bin/python -c "import lcviz; lcviz.test(remote_data=True)" | |
# NOTE: Do not run this part for PR testing. | |
- name: Publish distribution 📦 to PyPI | |
uses: pypa/gh-action-pypi-publish@67339c736fd9354cd4f8cb0b744f2b82a74b5c70 # v1.12.3 | |
if: github.event_name != 'pull_request' |