@@ -23,7 +23,7 @@ jobs:
|
|||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- run: |
|
- run: |
|
||||||
./.gitea/scripts/update_dockerhub_api \
|
./update_dockerhub_api \
|
||||||
${{ secrets.DOCKERHUB_USERNAME }} \
|
${{ secrets.DOCKERHUB_USERNAME }} \
|
||||||
${{ secrets.DOCKERHUB_PASSWORD }} \
|
${{ secrets.DOCKERHUB_PASSWORD }} \
|
||||||
${{ gitea.repository }} \
|
${{ gitea.repository }} \
|
||||||
|
|||||||
Executable
+25
@@ -0,0 +1,25 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
DOCKERHUB_USERNAME="${1}"
|
||||||
|
DOCKERHUB_PASSWORD="${2}"
|
||||||
|
GITEA_OWNER_REPO="${3}"
|
||||||
|
GITEA_API_KEY="${4}"
|
||||||
|
gitea_username=$(echo "${GITEA_OWNER_REPO}" | sed 's/\/.*//')
|
||||||
|
repo_name=$(echo "${GITEA_OWNER_REPO}" | sed 's/^.*\///')
|
||||||
|
|
||||||
|
NEW_DOCKERHUB_TOKEN=$(curl -s -X POST "https://hub.docker.com/v2/auth/token" \
|
||||||
|
-H "Content-Type: application/json" \
|
||||||
|
-d "{\"identifier\": \"${DOCKERHUB_USERNAME}\", \"secret\": \"${DOCKERHUB_PASSWORD}\"}" \
|
||||||
|
| jq -r .access_token)
|
||||||
|
|
||||||
|
curl -X 'PUT' \
|
||||||
|
"https://gitea.happylizard.me/api/v1/repos/${gitea_username}/${repo_name}/actions/secrets/DOCKERHUB_TOKEN" \
|
||||||
|
-H 'accept: application/json' \
|
||||||
|
-H "Authorization: token ${GITEA_API_KEY}" \
|
||||||
|
-H 'Content-Type: application/json' \
|
||||||
|
-d "{
|
||||||
|
\"data\": \"${NEW_DOCKERHUB_TOKEN}\",
|
||||||
|
\"description\": \"\"
|
||||||
|
}"
|
||||||
|
|
||||||
|
|
||||||
Reference in New Issue
Block a user