1+ name : Build packages
2+
3+ on :
4+ push :
5+ branches :
6+ - master
7+ - ' integration/**'
8+
9+ jobs :
10+ build :
11+ # This section builds the distribution for all versions of Python listed in
12+ # the python-version matrix under strategy to confirm that it builds for
13+ # all of those versions. It then uploads the package built by Python 3.9
14+ # for use in later jobs.
15+ name : Build distribution
16+ runs-on : ubuntu-latest
17+ outputs :
18+ version : ${{ steps.extract_version.outputs.raw_version }}
19+ rc_version : ${{ steps.extract_release_candidate_version.outputs.version }}
20+ strategy :
21+ matrix :
22+ python-version : [3.9, 3.10, 3.11, 3.12, 3.13, 3.14]
23+ steps :
24+ - uses : actions/checkout@v4
25+ - name : Set up Python
26+ uses : actions/setup-python@v5
27+ with :
28+ python-version : " 3.x"
29+ - name : Extract version number from __about__.py
30+ shell : bash
31+ run : echo "raw_version=`sed -n 's/__version__ = \"\(.*\)\"/\1/p' < sarpy_apps/__about__.py`" >> $GITHUB_OUTPUT
32+ id : extract_version
33+ - name : Set version number for release candidate
34+ shell : bash
35+ if : contains(github.ref, 'refs/heads/integration/')
36+ run : |
37+ echo ${{ steps.extract_version.outputs.raw_version }}
38+ rc_version=${{ steps.extract_version.outputs.raw_version }}rc0
39+ sed -i -e "s/__version__ = \"${{ steps.extract_version.outputs.raw_version }}/__version__ = \"$rc_version/g" sarpy_apps/__about__.py
40+ echo "version=$rc_version" >> $GITHUB_OUTPUT
41+ id : extract_release_candidate_version
42+ - name : Install pypa/build
43+ run : >-
44+ python3 -m
45+ pip install
46+ build
47+ --user
48+ - name : Build a binary wheel and a source tarball
49+ run : python3 -m build
50+ - name : Store the distribution packages
51+ if : matrix.python-version == 3.9
52+ uses : actions/upload-artifact@v4
53+ with :
54+ name : python-package-distributions
55+ path : dist/
56+ # This job creates a GitHub release and uploads the package contents created
57+ # in the build job to the release.
58+ release :
59+ name : Create release
60+ needs : build
61+ runs-on : ubuntu-latest
62+ steps :
63+ - uses : actions/checkout@v4
64+ - name : Extract version number from __about__.py
65+ shell : bash
66+ run : |
67+ if "${{endswith(github.ref, 'master')}}"
68+ then
69+ echo "version=${{ needs.build.outputs.version }}" >> $GITHUB_OUTPUT
70+ else
71+ echo "version=${{ needs.build.outputs.rc_version }}" >> $GITHUB_OUTPUT
72+ fi
73+ id : extract_version
74+ - name : Create a release
75+ 76+ id : create_release
77+ env :
78+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
79+ with :
80+ tag_name : v${{ steps.extract_version.outputs.version }}
81+ release_name : Version ${{ steps.extract_version.outputs.version }}
82+ body : |
83+ Changes in this Release
84+ - Added the CphdVectorTFR class (Create a tool to visualize a CPHD
85+ vector's time-frequency representation)
86+ - Added release automation
87+ draft : false
88+ prerelease : false
89+ - name : Download all the dists
90+ uses : actions/download-artifact@v4
91+ with :
92+ name : python-package-distributions
93+ path : dist
94+ - name : Upload package
95+ uses : softprops/action-gh-release@v2
96+ with :
97+ tag_name : ${{ steps.extract_version.outputs.version }}
98+ draft : false
99+ prerelease : false
100+ files : dist/*
101+ # publish-to-pypi:
102+ # name: Publish to PyPI
103+ # needs: release
104+ # runs-on: ubuntu-latest
105+ # environment:
106+ # name: development
107+ # permissions:
108+ # id-token: write
109+ # steps:
110+ # - name: Download all the dists
111+ # uses: actions/download-artifact@v4
112+ # with:
113+ # name: python-package-distributions
114+ # path: dist
115+ # - name: Publish distribution to PyPI
116+ # uses: pypa/gh-action-pypi-publish@release/v1
117+ # with:
118+ # repository-url: https://pypi.org/legacy/
0 commit comments