Skip to content

Commit

Permalink
Fix chrisstore.co upload
Browse files Browse the repository at this point in the history
  • Loading branch information
jennydaman authored May 27, 2022
1 parent 9f4799e commit 1a988fd
Showing 1 changed file with 8 additions and 31 deletions.
39 changes: 8 additions & 31 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,15 @@ jobs:
docker pull localhost:5000/$dock_image
docker tag localhost:5000/$dock_image $dock_image
script=$(docker inspect --format '{{ (index .Config.Cmd 0) }}' $dock_image)
json="$(docker run --rm $dock_image $script --json)"
jq <<< "$json" # pretty print in log
echo "::set-output name=json::$json"
docker run --rm $dock_image $script --json > /tmp/description.json
jq < /tmp/description.json # print in log
echo "::set-output name=title::$(jq -r '.title' <<< "$json")"
- name: Upload to ChRIS Store
if: "!endsWith(steps.determine.outputs.dock_image, ':latest')"
uses: FNNDSC/chrisstore-action@master
with:
descriptor_file: /tmp/description.json
auth: ${{ secrets.CHRIS_STORE_USER }}
- name: Update DockerHub description
uses: peter-evans/dockerhub-description@v2
continue-on-error: true # it is not crucial that this works
Expand All @@ -132,31 +137,3 @@ jobs:
short-description: ${{ steps.pluginmeta.outputs.title }}
readme-filepath: ./README.rst
repository: ${{ steps.determine.outputs.repo }}

- name: Upload to ChRIS Store
if: "!endsWith(steps.determine.outputs.dock_image, ':latest')"
run: |
repo=${{ steps.determine.outputs.repo }}
dock_image=${{ steps.determine.outputs.dock_image }}
plname="$(sed 's/^.*\///' <<< $repo)" && echo "name=$plname"
descriptor_file=$(mktemp --suffix .json)
cat > $descriptor_file <<< '${{ steps.pluginmeta.outputs.json }}'
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"
echo "$res"
exit $success
fi

0 comments on commit 1a988fd

Please sign in to comment.