Skip to content

Commit

Permalink
updated CI/CD
Browse files Browse the repository at this point in the history
  • Loading branch information
Sandip117 committed Oct 1, 2024
1 parent e2d3804 commit ed9f126
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 26 deletions.
61 changes: 36 additions & 25 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down

0 comments on commit ed9f126

Please sign in to comment.