From ed9f126f9a066b4b792ca357064a578cfd282d1b Mon Sep 17 00:00:00 2001 From: "sandipsamal117@gmail.com" Date: Tue, 1 Oct 2024 18:03:50 -0400 Subject: [PATCH] updated CI/CD --- .github/workflows/ci.yml | 61 ++++++++++++++++++++++++---------------- setup.py | 2 +- 2 files changed, 37 insertions(+), 26 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2f44e0e..5074c41 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -136,32 +136,43 @@ jobs: readme-filepath: ./README.rst repository: ${{ steps.determine.outputs.repo }} - - name: Upload to ChRIS Store - if: "!endsWith(steps.determine.outputs.dock_image, ':latest')" + - name: Upload ChRIS Plugin + id: upload + if: github.ref_type == 'tag' run: | - dock_image=${{ steps.determine.outputs.dock_image }} - plname="$(sed 's/^.*\///' <<< $GITHUB_REPOSITORY)" && echo "name=$plname" - descriptor_file=$(mktemp --suffix .json) - cat > $descriptor_file << ENDOFPLUGINJSONDESCRIPTION - ${{ steps.pluginmeta.outputs.json }} - ENDOFPLUGINJSONDESCRIPTION - res=$( - curl -s -u "${{ secrets.CHRIS_STORE_USER }}" "https://chrisstore.co/api/v1/plugins/" \ - -H 'Accept:application/vnd.collection+json' \ - -F "name=$plname" \ - -F "dock_image=$dock_image" \ - -F "descriptor_file=@$descriptor_file" \ - -F "public_repo=https://github.com/${{ github.repository }}" - ) - success=$? - echo "::debug::$res" - if [ "$success" = "0" ]; then - href="$(jq -r '.collection.items[0].href' <<< "$res")" - echo $href - echo "::set-output name=pluginurl::$href" - else - echo "::error ::Failed upload to ChRIS Store" + auth='${{ secrets.CHRISPROJECT_USERNAME }}:${{ secrets.CHRISPROJECT_PASSWORD }}' + chris_url="https://cube.chrisproject.org/api/v1/" + admin_url="$(curl -sSf -u "$auth" $chris_url -H 'Accept: application/json' | jq -r '.collection_links.admin')" + compute_names="NERC" + if [ "$admin_url" = "null" ]; then + echo "::error ::${{ secrets.CHRISPROJECT_USERNAME }} is not an admin for $chris_url" + exit 1 + fi + + set +e + res="$( + curl -sS -u "$auth" "$admin_url" \ + -H 'Accept: application/json' \ + -F fname=@- \ + -F compute_names=$compute_names \ + < /tmp/description.json + )" + rc=$? + + if [ "$rc" != "0" ]; then + echo "Description >>>" + cat /tmp/description.json + echo "Response >>>" echo "$res" - exit $success + + echo "::error ::Failed to upload plugin to $admin_url" + exit "$rc" fi + + echo "id=$(jq -r .id <<< "$res")" >> "$GITHUB_OUTPUT" + echo "url=$(jq -r .url <<< "$res")" >> "$GITHUB_OUTPUT" + echo "title=$(jq -r .title <<< "$res")" >> "$GITHUB_OUTPUT" + - name: Clean up temporary file + shell: bash + run: rm /tmp/description.json diff --git a/setup.py b/setup.py index de4da35..dacb35e 100755 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ setup( name='markimg', - version='1.5.9', + version='1.6.0', description='An app to mark landmark points and lines on an input image', long_description=readme, author='FNNDSC',