Skip to content

Feature/optional sample id linkage #26

Feature/optional sample id linkage

Feature/optional sample id linkage #26

name: Update DockerHub Description
on:
push:
branches:
- main
- develop
tags:
- '*.*.*'
pull_request:
branches:
- main
- develop
jobs:
update-dockerhub:
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
uses: actions/checkout@v3
- name: Update DockerHub Description
env:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
DOCKERHUB_REPO: "samply/obds2fhir"
run: |
# Read the content of the README.md file and escape newlines and quotes
DESCRIPTION=$(jq -Rs '.' README.md)
# Log in to DockerHub and get the JWT token
TOKEN_RESPONSE=$(curl -s -H "Content-Type: application/json" -X POST -d '{"username": "'"${DOCKERHUB_USERNAME}"'", "password": "'"${DOCKERHUB_TOKEN}"'"}' https://hub.docker.com/v2/users/login/)
TOKEN=$(echo $TOKEN_RESPONSE | jq -r .token)
# Update the DockerHub repository description
UPDATE_RESPONSE=$(curl -s -X PATCH \
-H "Authorization: JWT $TOKEN" \
-H "Content-Type: application/json" \
-d '{"full_description": '"$DESCRIPTION"'}' \
https://hub.docker.com/v2/repositories/${DOCKERHUB_REPO}/)
echo "Update response: $UPDATE_RESPONSE"