Merge pull request #31 from TaskarCenterAtUW/develop #15
Workflow file for this run
This file contains hidden or 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: Check and Publish to PyPi | |
| on: | |
| push: | |
| tags: | |
| - '*.*.*' # Eg. 0.0.1 | |
| workflow_dispatch: | |
| jobs: | |
| PublishToPyPi: | |
| environment: | |
| name: Production | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout source code | |
| uses: actions/checkout@v3 | |
| - name: Installing python 3.10 | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.10' | |
| - name: Adding GDAL PPA | |
| run: sudo apt-add-repository ppa:ubuntugis/ubuntugis-unstable | |
| - name: Updating Ubuntu | |
| run: sudo apt-get update | |
| - name: Install GDAL development | |
| run: sudo apt-get install gdal-bin libgdal-dev | |
| - name: Installing git | |
| run: pip install gitpython | |
| - name: Installing GDAL Package | |
| run: pip install GDAL==3.7.3 | |
| - name: Installing Packages | |
| run: pip install -r requirements.txt | |
| - name: Generate local version | |
| run: python freeze_version.py | |
| - name: Fetch local package version | |
| run: | | |
| packageLocalVersion=$(python -c 'from version import version; print(version);') | |
| echo "localVersion=$packageLocalVersion" >> $GITHUB_ENV | |
| - name: Fetch remote package version | |
| run: | | |
| packageRemoteVersion=$(python -c "exec(\"import pkg_resources\\ntry: print(pkg_resources.get_distribution('osm-osw-reformatter').version)\\nexcept pkg_resources.DistributionNotFound: print('0.0.0');\")") | |
| echo "remoteVersion=$packageRemoteVersion" >> $GITHUB_ENV | |
| - name: Printing local and remote versions | |
| run: echo "Local version ${{env.localVersion}} and remote version ${{env.remoteVersion}}" | |
| - name: Compare local and remote version with dpkg | |
| run: dpkg --compare-versions ${{env.localVersion}} "gt" ${{env.remoteVersion}} | |
| - name: Setup python wheel | |
| run: pip install wheel | |
| - name: Building Package | |
| run: python setup.py bdist_wheel | |
| - name: Publish package | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| with: | |
| password: ${{ secrets.PYPI_API_TOKEN }} | |