Skip to content

Commit

Permalink
Merge pull request #353 from iishiishii/main
Browse files Browse the repository at this point in the history
Add separate Zenodo upload workflow for testing
  • Loading branch information
iishiishii authored Feb 17, 2025
2 parents 8684f82 + 4d74d5e commit 4f33aee
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/publish-doi.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,14 @@ def upload_container(container_filepath, container_name, token):
# Upload the simg container to bucket in the created deposition
# The target URL is a combination of the bucket link with the desired filename
# seperated by a slash.
print("Uploading container to Zenodo...", container_filepath, os.path.basename(container_filepath))
with open(container_filepath, "rb") as fp:
r = requests.put(
"%s/%s" % (bucket_url, os.path.basename(container_filepath)), # bucket is a flat structure, can't include subfolders in it
data=fp,
params=params,
)
print("Upload", r.json())

# Update the metadata
data = {
Expand All @@ -43,6 +45,7 @@ def upload_container(container_filepath, container_name, token):
# Publish the deposition
r = requests.post('https://sandbox.zenodo.org/api/deposit/depositions/%s/actions/publish' % deposition_id,
params=params )
print("Publish", r.json())

# Get the DOI from the deposition
r = requests.get('https://sandbox.zenodo.org/api/deposit/depositions/%s' % deposition_id,
Expand Down
27 changes: 27 additions & 0 deletions .github/workflows/test-zenodo-workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Update neurocontainers

on:
workflow_dispatch:
push:
branches:
- main

jobs:
upload_containers_simg:
runs-on: self-hosted
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.ACCESS_TOKEN }}
- uses: actions/setup-python@v5
with:
python-version: 3.8
- name : Check if singularity container files exist in nectar cloud and build & upload if not there
run: |
IMAGE_HOME=/home/runner
IMAGENAME_BUILDDATE=dicomtools_1.0.0_20250204
echo "[DEBUG] ${IMAGENAME_BUILDDATE}.simg exists in temporary cache on nectar cloud"
curl --output "$IMAGE_HOME/${IMAGENAME_BUILDDATE}.simg" "https://object-store.rc.nectar.org.au/v1/AUTH_dead991e1fa847e3afcca2d3a7041f5d/neurodesk/temporary-builds-new/${IMAGENAME_BUILDDATE}.simg"
echo "Upload container $IMAGE_HOME/${IMAGENAME_BUILDDATE}.simg to Zenodo"
echo $(find $IMAGE_HOME/${IMAGENAME_BUILDDATE}.simg)
export DOI_URL=$(python3 .github/workflows/publish-doi.py --container_filepath="$IMAGE_HOME/${IMAGENAME_BUILDDATE}.simg" --container_name=${IMAGENAME_BUILDDATE} --token=${{ secrets.ZENODO_TOKEN }})

0 comments on commit 4f33aee

Please sign in to comment.