File tree Expand file tree Collapse file tree 5 files changed +71
-18
lines changed
Expand file tree Collapse file tree 5 files changed +71
-18
lines changed Original file line number Diff line number Diff line change 1212
1313jobs :
1414 dockerize :
15+ name : Build Docker image and push to GitHub Container Registry
1516 runs-on : ubuntu-latest
1617 steps :
1718 - uses : actions/checkout@v2
3132 - name : Set environment variables for docker build
3233 run : |
3334 # Lowercase repo for Github Container Registry
34- echo "REPO=${GITHUB_REPOSITORY,,}" >>${GITHUB_ENV}
35+ echo "REPO=${GITHUB_REPOSITORY,,}" >> ${GITHUB_ENV}
3536 # Ensure tags are checked out
3637 git fetch origin +refs/tags/*:refs/tags/*
3738 # Version number from tag
Original file line number Diff line number Diff line change 1+ # link: https://packaging.python.org/en/latest/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/
2+ name : publish distributions 📦 to PyPI and TestPyPI
3+
4+ on :
5+ push :
6+ branches :
7+ - main
8+ tags :
9+ - v*
10+
11+ jobs :
12+ build-n-publish :
13+ if : github.repository_owner == 'insarlab'
14+
15+ name : Build and publish Python 🐍 distributions 📦 to PyPI and TestPyPI
16+ runs-on : ubuntu-latest
17+ steps :
18+ - uses : actions/checkout@v3
19+ with :
20+ fetch-depth : 0
21+
22+ - name : Set up Python 3.10
23+ uses : actions/setup-python@v3
24+ with :
25+ python-version : " 3.10"
26+
27+ - name : Install pypa/build
28+ run : >-
29+ python -m
30+ pip install
31+ build
32+ --user
33+
34+ - name : Build a binary wheel and a source tarball
35+ run : >-
36+ python -m
37+ build
38+ --sdist
39+ --wheel
40+ --outdir dist/
41+ .
42+
43+ - name : Publish developed version 📦 to Test PyPI
44+ if : github.ref == 'refs/heads/main'
45+ uses : pypa/gh-action-pypi-publish@release/v1
46+ with :
47+ password : ${{ secrets.TEST_PYPI_API_TOKEN }}
48+ repository_url : https://test.pypi.org/legacy/
49+ skip_existing : false
50+ verbose : true
51+
52+ - name : Publish released version 📦 to PyPI
53+ if : startsWith(github.ref, 'refs/tags/v')
54+ uses : pypa/gh-action-pypi-publish@release/v1
55+ with :
56+ password : ${{ secrets.PYPI_API_TOKEN }}
57+ verbose : true
58+
Original file line number Diff line number Diff line change 11# get version info
22from mintpy .version import (
3- version_num as __version__ ,
3+ version as __version__ ,
44 logo as __logo__ ,
55)
Original file line number Diff line number Diff line change @@ -67,9 +67,9 @@ def get_version_info():
6767
6868###########################################################################
6969
70- version_num , version_date = get_version_info ()
70+ version , version_date = get_version_info ()
7171version_description = """MintPy version {v}, date {d}""" .format (
72- v = version_num ,
72+ v = version ,
7373 d = version_date ,
7474)
7575
@@ -90,7 +90,7 @@ def get_version_info():
9090 Miami InSAR Time-series software in Python \______/
9191 MintPy {v}, {d}
9292___________________________________________________________
93- """ .format (v = version_num , d = version_date )
93+ """ .format (v = version , d = version_date )
9494
9595website = 'https://github.com/insarlab/MintPy'
9696
Original file line number Diff line number Diff line change 55# Author: Zhang Yunjun, Nov 2020 #
66############################################################
77
8-
8+ import os
9+ import sys
910# Always prefer setuptools over distutils
1011from setuptools import setup , find_packages
1112
13+ # Grab version and description from version.py
14+ # link: https://stackoverflow.com/questions/53648900
15+ sys .path .append (os .path .dirname (__file__ ))
16+ from mintpy .version import version , description
1217
13- # Grab from README file: long_description
18+ # Grab long_description from README.md
1419with open ("docs/README.md" , "r" ) as f :
1520 long_description = f .read ()
1621
17- # Grab from version.py file: version and description
18- with open ("mintpy/version.py" , "r" ) as f :
19- lines = f .readlines ()
20- # version
21- line = [line for line in lines if line .strip ().startswith ("Tag(" )][0 ].strip ()
22- version = line .replace ("'" ,'"' ).split ('"' )[1 ]
23- # description
24- line = [line for line in lines if line .startswith ("description" )][0 ].strip ()
25- description = line .replace ("'" ,'"' ).split ('"' )[1 ]
26-
27-
2822setup (
2923 name = "mintpy" ,
3024 version = version ,
You can’t perform that action at this time.
0 commit comments