Skip to content

Commit

Permalink
🔄Refactor workflow script
Browse files Browse the repository at this point in the history
  • Loading branch information
coreequip committed Feb 5, 2025
1 parent 4d4dd5f commit 5fa4a62
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 17 deletions.
17 changes: 0 additions & 17 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,20 +32,3 @@ jobs:
tags: |
easybill/spf-check:${{ github.ref_name }}
easybill/spf-check:latest
- name: Update Docker Hub description
env:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
run: |
echo "Logging into Docker Hub..."
TOKEN=$(curl -s -H "Content-Type: application/json" \
-d '{"username": "'"DOCKERHUB_USERNAME"'", "password": "'"$DOCKERHUB_TOKEN"'"}' \
https://hub.docker.com/v2/users/login/ | jq -r .token)
echo "Updating Docker Hub description..."
curl -s -X PATCH \
-H "Authorization: JWT $TOKEN" \
-H "Content-Type: application/json" \
--data '{"full_description": "'"$(<README.md)"'"}' \
https://hub.docker.com/v2/repositories/easybill/spf-check/
29 changes: 29 additions & 0 deletions .github/workflows/update-dockerhub-readme.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: update-dockerhub-readme

on:
workflow_dispatch:

jobs:
update-readme:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Update Docker Hub description
env:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
run: |
echo "Logging into Docker Hub..."
TOKEN=$(curl -s -H "Content-Type: application/json" \
-d '{"username": "'"$DOCKERHUB_USERNAME"'", "password": "'"$DOCKERHUB_TOKEN"'"}' \
https://hub.docker.com/v2/users/login/ | jq -r .token)
echo "Updating Docker Hub description..."
curl -s -X PATCH \
-H "Authorization: JWT $TOKEN" \
-H "Content-Type: application/json" \
--data '{"full_description": "'"$(<README.md)"'"}' \
https://hub.docker.com/v2/repositories/easybill/spf-check/

0 comments on commit 5fa4a62

Please sign in to comment.