-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #432 from Distributive-Network/Xmader/ci/upload-ar…
…chive Add CI for publishing to ⊇istributive's archive server
- Loading branch information
Showing
1 changed file
with
49 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ on: | |
branches: | ||
- main | ||
tags: | ||
- '*' | ||
- 'v*' | ||
workflow_call: | ||
workflow_dispatch: | ||
inputs: | ||
|
@@ -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: | ||
|
@@ -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 | ||
|
@@ -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 | ||
|
@@ -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 |