@@ -118,11 +118,12 @@ jobs:
118
118
name : html-docs
119
119
path : ./docs/_build/html
120
120
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"
123
124
runs-on : ubuntu-latest
124
125
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
126
127
127
128
steps :
128
129
- name : Checkout repository
@@ -158,38 +159,74 @@ jobs:
158
159
159
160
- name : Archive distribution artifacts
160
161
# Archive distribution files for use by auto (or manual) PyPI upload
161
- uses : actions/upload-artifact@v2
162
+ uses : actions/upload-artifact@v3
162
163
with :
163
164
name : pypi-dist
164
165
path : ./dist
165
166
166
167
- name : Archive changelog artifacts
167
- uses : actions/upload-artifact@v2
168
+ uses : actions/upload-artifact@v3
168
169
with :
169
170
name : release_notes
170
171
path : release_notes.md
171
172
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
172
193
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.
173
210
publish :
174
211
name : " Publish"
175
212
runs-on : ubuntu-latest
176
- needs : [gh-pages, build]
177
- steps :
213
+ needs : [gh-pages, build_pypi, build_conda]
178
214
215
+ steps :
179
216
- name : Download documentation
180
- uses : actions/download-artifact@v2
217
+ uses : actions/download-artifact@v3
181
218
with :
182
219
name : html-docs
183
220
path : ./html-docs
184
221
185
222
- name : Download release
186
- uses : actions/download-artifact@v2
223
+ uses : actions/download-artifact@v3
187
224
with :
188
225
name : pypi-dist
189
226
path : ./dist
190
227
191
228
- name : Download release notes
192
- uses : actions/download-artifact@v2
229
+ uses : actions/download-artifact@v3
193
230
with :
194
231
name : release_notes
195
232
@@ -199,6 +236,7 @@ jobs:
199
236
- name : Display structure of downloaded files
200
237
run : ls -R
201
238
239
+ # Create a draft release on GitHub
202
240
- name : Create Release
203
241
id : create_release
204
242
uses : softprops/action-gh-release@v1
@@ -208,6 +246,7 @@ jobs:
208
246
body : " "
209
247
files : documentation.zip
210
248
249
+ # Publish the documentation to GitHub Pages
211
250
- name : Deploy documentation
212
251
uses : peaceiris/actions-gh-pages@v3
213
252
with :
@@ -221,10 +260,45 @@ jobs:
221
260
password : ${{ secrets.PYPI_API_TOKEN }}
222
261
verbose : true
223
262
263
+ # Publish the release on GitHub (remove draft status)
224
264
- name : Publish release
225
265
uses : StuYarrow/publish-release@v1
226
266
env :
227
267
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
228
268
with :
229
269
id : ${{ steps.create_release.outputs.id }}
230
270
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