add packages to package list #30
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: Publish Package | |
on: push | |
env: | |
version: ${{ github.run_id }}.post${{ github.run_attempt }} | |
jobs: | |
build: | |
name: Build distribution | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.x" | |
- name: Install pypa/build | |
run: >- | |
python3 -m | |
pip install | |
build | |
--user | |
- name: Build a binary wheel and a source tarball | |
run: python3 -m build | |
- name: Store the distribution packages | |
uses: actions/upload-artifact@v3 | |
with: | |
name: python-package-distributions | |
path: dist/ | |
test: | |
name: Test distribution | |
needs: | |
- build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Download all the dists | |
uses: actions/download-artifact@v3 | |
with: | |
name: python-package-distributions | |
path: dist/ | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.x' | |
- name: Test | |
run: | |
pip install dist/py_spw-${{ github.run_id }}.post${{ github.run_attempt }}.tar.gz | |
publish-to-testpypi: | |
name: Publish distribution | |
needs: | |
- test | |
runs-on: ubuntu-latest | |
environment: | |
name: testpypi | |
url: https://test.pypi.org/p/Py-SPW | |
permissions: | |
id-token: write # IMPORTANT: mandatory for trusted publishing | |
if: github.ref == 'refs/heads/dev' | |
steps: | |
- name: Download all the dists | |
uses: actions/download-artifact@v3 | |
with: | |
name: python-package-distributions | |
path: dist/ | |
- name: Publish distribution to TestPyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
repository-url: https://test.pypi.org/legacy/ | |
- name: Test | |
run: | | |
echo Release published on https://test.pypi.org/project/Py-SPW/$version/ | |
echo Install - pip install -i https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple Py-SPW==$version |