From c8f09304f8cb1dbc6a5faf024887c9622c7f3598 Mon Sep 17 00:00:00 2001 From: "sandipsamal117@gmail.com" Date: Wed, 2 Oct 2024 17:29:44 -0400 Subject: [PATCH] update CI/CD --- .github/workflows/ci.yml | 65 +++++++++++++--------------------------- setup.py | 2 +- 2 files changed, 21 insertions(+), 46 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 881fbe6..840aad0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,7 +22,7 @@ on: jobs: test: if: false - runs-on: ubuntu-20.04 + runs-on: ubuntu-24.04 steps: - uses: actions/checkout@v2 - name: build @@ -32,7 +32,7 @@ jobs: publish: if: github.event_name == 'push' || github.event_name == 'release' - runs-on: ubuntu-20.04 + runs-on: ubuntu-24.04 # we want to both push the build to DockerHub, but also # keep a local copy so that we can run @@ -89,9 +89,9 @@ jobs: with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_PASSWORD }} - + - name: Login to GitHub Container Registry - uses: docker/login-action@v1 + uses: docker/login-action@v1 with: registry: ghcr.io username: ${{ github.repository_owner }} @@ -120,11 +120,16 @@ 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) - docker run --rm $dock_image $script --json > /tmp/description.json - jq <<< "$json" # pretty print in log + docker run --rm $dock_image $script --json \ + | jq '. += {"name":"pl-markimg", "dock_image": "'$dock_image'", "public_repo": "'${{ github.server_url }}/${{ github.repository }}'" }' \ + > /tmp/description.json + json="$(docker run --rm $dock_image $script --json)" + # Escape single quotes + json_escaped=$(echo "$json" | sed "s/'/\\'/g") - echo "::set-output name=json::$json" - echo "::set-output name=title::$(jq -r '.title' <<< "$json")" + jq <<< "$json" # pretty print in log + echo "json=$json_escaped" >> $GITHUB_OUTPUT + echo "title=$(jq -r '.title' <<< "$json")" >> $GITHUB_OUTPUT - name: Update DockerHub description uses: peter-evans/dockerhub-description@v2 @@ -139,40 +144,10 @@ jobs: - name: Upload ChRIS Plugin id: upload if: github.ref_type == 'tag' - run: | - 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" - - 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 + uses: FNNDSC/upload-chris-plugin@main + with: + description_file: /tmp/description.json + username: ${{ secrets.CHRISPROJECT_USERNAME }} + password: ${{ secrets.CHRISPROJECT_PASSWORD }} + chris_url: https://cube.chrisproject.org/api/v1/ + compute_names: NERC \ No newline at end of file diff --git a/setup.py b/setup.py index 34d555e..4bb7708 100755 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ setup( name='markimg', - version='1.6.1', + version='1.6.2', description='An app to mark landmark points and lines on an input image', long_description=readme, author='FNNDSC',