https://github.com/RadioAstronomySoftwareGroup/pyuvdata
Raw File
Tip revision: 16b1cd62aec168d95695e3605dba8f616b36aceb authored by pyxieloustar on 01 November 2021, 15:42 UTC
address comments, keyword depracation, docstrings
Tip revision: 16b1cd6
publish-to-test-pypi.yaml
name: Publish Python distributions to PyPI and TestPyPI

on: [push, pull_request]

jobs:
  build-n-publish:
    name: Build and publish to PyPI and TestPyPI
    runs-on: ubuntu-latest
    defaults:
      run:
        # Adding -l {0} helps ensure conda can be found properly.
        shell: bash -l {0}
    env:
      ENV_NAME: pyuvdata_publish
      PYTHON: 3.7
    steps:
      - uses: actions/checkout@main
        with:
          fetch-depth: 0

      - name: Setup Miniconda
        uses: conda-incubator/setup-miniconda@v2.0.0
        with:
          auto-update-conda: true
          miniconda-version: "latest"
          python-version: ${{ env.PYTHON }}
          environment-file: ci/${{ env.ENV_NAME }}.yml
          activate-environment: ${{ env.ENV_NAME }}

      - name: Conda Info
        run: |
          conda info -a
          conda list
          PYVER=`python -c "import sys; print('{:d}.{:d}'.format(sys.version_info.major, sys.version_info.minor))"`
          if [[ $PYVER != ${{ env.PYTHON }} ]]; then
            exit 1;
          fi

      - name: Create environment variable
        if: startsWith(github.ref, 'refs/tags/') != true
        run: |
          wget https://gist.github.com/plaplant/0902f09e59166bac742bbd554f3cd2f9/raw/make_dev_version.sh
          version=$(bash make_dev_version.sh)
          echo "SETUPTOOLS_SCM_PRETEND_VERSION=$version" >> $GITHUB_ENV

      - name: Check environment variable
        run: echo $SETUPTOOLS_SCM_PRETEND_VERSION

      - name: Build a binary wheel and a source tarball
        run: |
          python -m pep517.build --source --out-dir dist/ .

      - name: Publish to Test PyPI
        if: startsWith(github.event.ref, 'refs/tags')
        uses: pypa/gh-action-pypi-publish@master
        with:
          password: ${{ secrets.test_pypi_password }}
          repository_url: https://test.pypi.org/legacy/

      - name: Publish to PyPI
        if: startsWith(github.event.ref, 'refs/tags')
        uses: pypa/gh-action-pypi-publish@master
        with:
          password: ${{ secrets.pypi_password }}
back to top