@@ -118,11 +118,12 @@ jobs:
118118 name : html-docs
119119 path : ./docs/_build/html
120120
121- build :
122- name : " Build Package"
121+ # Build a package for distribution through PyPI.org (pip install sasctl)
122+ build_pypi :
123+ name : " Build PyPI Package"
123124 runs-on : ubuntu-latest
124125 needs : test
125- if : startsWith(github.ref, 'refs/tags/') # run only on tagged commits
126+ if : startsWith(github.ref, 'refs/tags/') # run only on tagged commits
126127
127128 steps :
128129 - name : Checkout repository
@@ -158,38 +159,74 @@ jobs:
158159
159160 - name : Archive distribution artifacts
160161 # Archive distribution files for use by auto (or manual) PyPI upload
161- uses : actions/upload-artifact@v2
162+ uses : actions/upload-artifact@v3
162163 with :
163164 name : pypi-dist
164165 path : ./dist
165166
166167 - name : Archive changelog artifacts
167- uses : actions/upload-artifact@v2
168+ uses : actions/upload-artifact@v3
168169 with :
169170 name : release_notes
170171 path : release_notes.md
171172
173+ # Build a package for distribution through Anaconda.org (conda install sasctl)
174+ build_conda :
175+ name : " Build Conda Package"
176+ runs-on : ubuntu-latest
177+ needs : test
178+ if : startsWith(github.ref, 'refs/tags/') # run only on tagged commits
179+
180+ steps :
181+ # Setup Miniconda
182+ - uses : conda-incubator/setup-miniconda@v2
183+ with :
184+ auto-update-conda : true
185+
186+ - name : Install conda-build
187+ shell : bash -l {0}
188+ run : |
189+ conda install conda-build
190+
191+ - name : Checkout repository
192+ uses : actions/checkout@v3
172193
194+ # Build package and store results in .build folder
195+ - name : Build package
196+ shell : bash -l {0}
197+ run : |
198+ conda build --output-folder .build .conda
199+
200+ # Archive distribution files. Will upload in a downstream job.
201+ - name : Archive distribution artifacts
202+ uses : actions/upload-artifact@v3
203+ with :
204+ name : conda-dist
205+ path : .build
206+
207+
208+ # Publishes the new package to PyPI, uploads the latest documentation to GitHub Pages
209+ # and creates a new release with change notes on GitHub.
173210 publish :
174211 name : " Publish"
175212 runs-on : ubuntu-latest
176- needs : [gh-pages, build]
177- steps :
213+ needs : [gh-pages, build_pypi, build_conda]
178214
215+ steps :
179216 - name : Download documentation
180- uses : actions/download-artifact@v2
217+ uses : actions/download-artifact@v3
181218 with :
182219 name : html-docs
183220 path : ./html-docs
184221
185222 - name : Download release
186- uses : actions/download-artifact@v2
223+ uses : actions/download-artifact@v3
187224 with :
188225 name : pypi-dist
189226 path : ./dist
190227
191228 - name : Download release notes
192- uses : actions/download-artifact@v2
229+ uses : actions/download-artifact@v3
193230 with :
194231 name : release_notes
195232
@@ -199,6 +236,7 @@ jobs:
199236 - name : Display structure of downloaded files
200237 run : ls -R
201238
239+ # Create a draft release on GitHub
202240 - name : Create Release
203241 id : create_release
204242 uses : softprops/action-gh-release@v1
@@ -208,6 +246,7 @@ jobs:
208246 body : " "
209247 files : documentation.zip
210248
249+ # Publish the documentation to GitHub Pages
211250 - name : Deploy documentation
212251 uses : peaceiris/actions-gh-pages@v3
213252 with :
@@ -221,10 +260,45 @@ jobs:
221260 password : ${{ secrets.PYPI_API_TOKEN }}
222261 verbose : true
223262
263+ # Publish the release on GitHub (remove draft status)
224264 - name : Publish release
225265 uses : StuYarrow/publish-release@v1
226266 env :
227267 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
228268 with :
229269 id : ${{ steps.create_release.outputs.id }}
230270
271+
272+ # Uploads the package to Anaconda.
273+ # NOTE: could be merged with `publish` job above. Left as a separate, final job since it
274+ # involves multiple steps to setup the environment and if this job fails, the package
275+ # has already been made available through pip, and the release info published.
276+ upload_conda :
277+ name : " Upload Conda Package"
278+ runs-on : ubuntu-latest
279+ needs : [publish]
280+
281+ steps :
282+ # Setup Miniconda
283+ - uses : conda-incubator/setup-miniconda@v2
284+ with :
285+ auto-update-conda : true
286+
287+ # Setup Anaconda client (required for upload)
288+ - name : Install anaconda client
289+ shell : bash -l {0}
290+ run : |
291+ conda install anaconda-client
292+
293+ # Download release files
294+ - name : Download release
295+ uses : actions/download-artifact@v3
296+ with :
297+ name : conda-dist
298+ path : ./dist
299+
300+ # Upload release to Anaconda.org
301+ - name : Upload release
302+ shell : bash -l {0}
303+ run : |
304+ anaconda -t ${{ secrets.ANACONDA_TOKEN }} upload -u sas-institute ./dist/noarch/sasctl-*.tar.bz2
0 commit comments