Skip to content

Commit

Permalink
Merge pull request #432 from Distributive-Network/Xmader/ci/upload-ar…
Browse files Browse the repository at this point in the history
…chive

Add CI for publishing to ⊇istributive's archive server
  • Loading branch information
philippedistributive authored Sep 10, 2024
2 parents 19efee8 + b774b58 commit ce0394d
Showing 1 changed file with 49 additions and 3 deletions.
52 changes: 49 additions & 3 deletions .github/workflows/test-and-publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
branches:
- main
tags:
- '*'
- 'v*'
workflow_call:
workflow_dispatch:
inputs:
Expand Down Expand Up @@ -54,6 +54,10 @@ defaults:
# run with Git Bash on Windows
shell: bash

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build-spidermonkey-unix:
strategy:
Expand Down Expand Up @@ -297,7 +301,7 @@ jobs:
publish:
needs: [build-and-test, sdist]
runs-on: ubuntu-20.04
if: ${{ success() && github.event_name == 'push' && contains(github.ref, 'refs/tags/') }}
if: ${{ success() && github.event_name == 'push' && github.ref_type == 'tag' }}
steps:
# no need to checkout
- uses: actions/setup-python@v5
Expand All @@ -320,7 +324,7 @@ jobs:
# and deploy the static files to GitHub Pages
needs: [build-and-test, sdist]
runs-on: ubuntu-20.04
if: ${{ (success() || failure()) && github.ref_name == 'main' }} # publish nightly builds regardless of tests failure
if: ${{ (success() || failure()) && (github.ref_name == 'main' || github.ref_type == 'tag') }} # publish nightly builds regardless of tests failure
permissions: # grant GITHUB_TOKEN the permissions required to make a Pages deployment
pages: write
id-token: write
Expand Down Expand Up @@ -375,3 +379,45 @@ jobs:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2
publish-archive:
# Publish to ⊇istributive's archive server (https://archive.distributed.computer/releases/pythonmonkey/)
needs: [build-and-test, sdist]
runs-on: ubuntu-20.04
if: ${{ (success() || failure()) && (github.ref_name == 'main' || github.ref_type == 'tag') }}
environment:
name: archive
url: https://archive.distributed.computer/releases/pythonmonkey/${{ steps.get_path.outputs.ARCHIVE_PATH }}
steps:
# no need to checkout
- name: Download wheels built
uses: actions/download-artifact@v3
with:
name: wheel-${{ github.run_id }}-${{ github.sha }}
path: ./
- name: Download docs html generated by Doxygen
uses: actions/download-artifact@v3
with:
name: docs-${{ github.run_id }}-${{ github.sha }}
path: ./docs/
- name: Get the pythonmonkey/pminit version number
run: |
file=$(ls ./pminit*.tar.gz | head -1)
pm_version=$(basename "${file%.tar.gz}" | cut -d- -f2) # match /pminit-([^-]+).tar.gz/
echo "PM_VERSION=$pm_version" >> $GITHUB_ENV
- name: Get the archive type (nightly or releases) and path
id: get_path
run: |
path="$ARCHIVE_TYPE/$PM_VERSION/"
echo "$path"
echo "ARCHIVE_PATH=$path" >> $GITHUB_OUTPUT
env:
ARCHIVE_TYPE: ${{ (github.ref_type == 'tag' && 'releases') || 'nightly' }}
- name: SCP to the archive server
uses: appleboy/[email protected]
with:
host: ${{ secrets.ARCHIVE_HOST }}
username: pythonmonkey
key: ${{ secrets.ARCHIVE_KEY }}
source: ./*
target: archive/${{ steps.get_path.outputs.ARCHIVE_PATH }}
overwrite: true

0 comments on commit ce0394d

Please sign in to comment.