-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3446484
commit 578c84e
Showing
1 changed file
with
41 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
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" |