Skip to content

Commit

Permalink
Merge pull request #358 from iishiishii/main
Browse files Browse the repository at this point in the history
Remove Zenodo doi creation from update neurocontainer action
  • Loading branch information
iishiishii authored Feb 21, 2025
2 parents dd98cbe + f41bbac commit 01c3c05
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 21 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/update-neurocontainers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
python-version: 3.8
- name : Check if singularity container files exist in nectar cloud and build & upload if not there
run: |
/bin/bash .github/workflows/upload_containers_simg.sh ${{ secrets.ZENODO_TOKEN }}
/bin/bash .github/workflows/upload_containers_simg.sh
- name: Auto commit changes to applist.json
uses: stefanzweifel/git-auto-commit-action@v4
id: auto-commit-action
Expand Down
4 changes: 1 addition & 3 deletions .github/workflows/upload_containers_simg.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,6 @@ do
# download simg file from cache:
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"
export DOI_URL=$(python3 .github/workflows/publish-doi.py --container_filepath="$IMAGE_HOME/${IMAGENAME_BUILDDATE}.simg" --container_name=${IMAGENAME_BUILDDATE} --token=$1)
echo "[DEBUG] Deleting file after download or when older than 30days from cache ..."
rclone delete nectar:/neurodesk/temporary-builds-new/${IMAGENAME_BUILDDATE}.simg
rclone delete --min-age 30d nectar:/neurodesk/temporary-builds-new
Expand Down Expand Up @@ -106,7 +104,7 @@ mv log.txt cvmfs

cd cvmfs
echo "[Debug] generate applist.json file for website"
python json_gen.py --application=$IMAGENAME_BUILDDATE --doi_url=$DOI_URL #this generates the applist.json for the website
python json_gen.py #this generates the applist.json for the website
# these files will be committed via uses: stefanzweifel/git-auto-commit-action@v4


Expand Down
20 changes: 3 additions & 17 deletions cvmfs/json_gen.py
Original file line number Diff line number Diff line change
@@ -1,31 +1,17 @@
import json
import argparse

def process_text_to_json(application, doi_url):
def process_text_to_json():
my_dict = {}
val = []

with open("log.txt") as f:
for line in f:
line = line.split()

# Find the matching application and update its DOI
if application in line[0]:
val.append({"application": line[0], "categories": ' '.join(line[1:]).replace("categories:","").rstrip(',').split(","), "doi": doi_url})
else:
val.append({"application": line[0], "categories": ' '.join(line[1:]).replace("categories:","").rstrip(',').split(",")})
val.append({"application": line[0], "categories": ' '.join(line[1:]).replace("categories:","").rstrip(',').split(",")})
my_dict['list'] = val

with open('applist.json', 'w') as fp:
json.dump(my_dict, fp, sort_keys=True, indent=4)

if __name__ == '__main__':
parser = argparse.ArgumentParser(
prog="Update DOI for app list",
)
parser.add_argument("--application", type=str, required=True, help="Application name and version")
parser.add_argument("--doi_url", type=str, required=True, help="DOI URL")

args = parser.parse_args()

process_text_to_json(args.application, args.doi_url)
process_text_to_json()

0 comments on commit 01c3c05

Please sign in to comment.