Skip to content

Commit ce0394d

Browse files
Merge pull request #432 from Distributive-Network/Xmader/ci/upload-archive
Add CI for publishing to ⊇istributive's archive server
2 parents 19efee8 + b774b58 commit ce0394d

File tree

1 file changed

+49
-3
lines changed

1 file changed

+49
-3
lines changed

.github/workflows/test-and-publish.yaml

+49-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ on:
55
branches:
66
- main
77
tags:
8-
- '*'
8+
- 'v*'
99
workflow_call:
1010
workflow_dispatch:
1111
inputs:
@@ -54,6 +54,10 @@ defaults:
5454
# run with Git Bash on Windows
5555
shell: bash
5656

57+
concurrency:
58+
group: ${{ github.workflow }}-${{ github.ref }}
59+
cancel-in-progress: true
60+
5761
jobs:
5862
build-spidermonkey-unix:
5963
strategy:
@@ -297,7 +301,7 @@ jobs:
297301
publish:
298302
needs: [build-and-test, sdist]
299303
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' }}
301305
steps:
302306
# no need to checkout
303307
- uses: actions/setup-python@v5
@@ -320,7 +324,7 @@ jobs:
320324
# and deploy the static files to GitHub Pages
321325
needs: [build-and-test, sdist]
322326
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
324328
permissions: # grant GITHUB_TOKEN the permissions required to make a Pages deployment
325329
pages: write
326330
id-token: write
@@ -375,3 +379,45 @@ jobs:
375379
- name: Deploy to GitHub Pages
376380
id: deployment
377381
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+
uses: appleboy/[email protected]
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

Comments
 (0)