5
5
branches :
6
6
- main
7
7
tags :
8
- - ' *'
8
+ - ' v *'
9
9
workflow_call :
10
10
workflow_dispatch :
11
11
inputs :
@@ -54,6 +54,10 @@ defaults:
54
54
# run with Git Bash on Windows
55
55
shell : bash
56
56
57
+ concurrency :
58
+ group : ${{ github.workflow }}-${{ github.ref }}
59
+ cancel-in-progress : true
60
+
57
61
jobs :
58
62
build-spidermonkey-unix :
59
63
strategy :
@@ -297,7 +301,7 @@ jobs:
297
301
publish :
298
302
needs : [build-and-test, sdist]
299
303
runs-on : ubuntu-20.04
300
- if : ${{ success() && github.event_name == 'push' && contains( github.ref, 'refs/tags/') }}
304
+ if : ${{ success() && github.event_name == 'push' && github.ref_type == 'tag' }}
301
305
steps :
302
306
# no need to checkout
303
307
- uses : actions/setup-python@v5
@@ -320,7 +324,7 @@ jobs:
320
324
# and deploy the static files to GitHub Pages
321
325
needs : [build-and-test, sdist]
322
326
runs-on : ubuntu-20.04
323
- if : ${{ (success() || failure()) && github.ref_name == 'main' }} # publish nightly builds regardless of tests failure
327
+ if : ${{ (success() || failure()) && ( github.ref_name == 'main' || github.ref_type == 'tag') }} # publish nightly builds regardless of tests failure
324
328
permissions : # grant GITHUB_TOKEN the permissions required to make a Pages deployment
325
329
pages : write
326
330
id-token : write
@@ -375,3 +379,45 @@ jobs:
375
379
- name : Deploy to GitHub Pages
376
380
id : deployment
377
381
uses : actions/deploy-pages@v2
382
+ publish-archive :
383
+ # Publish to ⊇istributive's archive server (https://archive.distributed.computer/releases/pythonmonkey/)
384
+ needs : [build-and-test, sdist]
385
+ runs-on : ubuntu-20.04
386
+ if : ${{ (success() || failure()) && (github.ref_name == 'main' || github.ref_type == 'tag') }}
387
+ environment :
388
+ name : archive
389
+ url : https://archive.distributed.computer/releases/pythonmonkey/${{ steps.get_path.outputs.ARCHIVE_PATH }}
390
+ steps :
391
+ # no need to checkout
392
+ - name : Download wheels built
393
+ uses : actions/download-artifact@v3
394
+ with :
395
+ name : wheel-${{ github.run_id }}-${{ github.sha }}
396
+ path : ./
397
+ - name : Download docs html generated by Doxygen
398
+ uses : actions/download-artifact@v3
399
+ with :
400
+ name : docs-${{ github.run_id }}-${{ github.sha }}
401
+ path : ./docs/
402
+ - name : Get the pythonmonkey/pminit version number
403
+ run : |
404
+ file=$(ls ./pminit*.tar.gz | head -1)
405
+ pm_version=$(basename "${file%.tar.gz}" | cut -d- -f2) # match /pminit-([^-]+).tar.gz/
406
+ echo "PM_VERSION=$pm_version" >> $GITHUB_ENV
407
+ - name : Get the archive type (nightly or releases) and path
408
+ id : get_path
409
+ run : |
410
+ path="$ARCHIVE_TYPE/$PM_VERSION/"
411
+ echo "$path"
412
+ echo "ARCHIVE_PATH=$path" >> $GITHUB_OUTPUT
413
+ env :
414
+ ARCHIVE_TYPE : ${{ (github.ref_type == 'tag' && 'releases') || 'nightly' }}
415
+ - name : SCP to the archive server
416
+
417
+ with :
418
+ host : ${{ secrets.ARCHIVE_HOST }}
419
+ username : pythonmonkey
420
+ key : ${{ secrets.ARCHIVE_KEY }}
421
+ source : ./*
422
+ target : archive/${{ steps.get_path.outputs.ARCHIVE_PATH }}
423
+ overwrite : true
0 commit comments