diff --git a/.github/workflows/publish-doi.py b/.github/workflows/publish-doi.py index 5e245353..4fcb6635 100644 --- a/.github/workflows/publish-doi.py +++ b/.github/workflows/publish-doi.py @@ -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 = { @@ -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, diff --git a/.github/workflows/test-zenodo-workflow.yml b/.github/workflows/test-zenodo-workflow.yml new file mode 100644 index 00000000..6d72dc12 --- /dev/null +++ b/.github/workflows/test-zenodo-workflow.yml @@ -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 }}) \ No newline at end of file