This might now work since DOCKERHUB_PASSWORD secret isnt set for some reason
Build and Push Docker Image / docker (push) Successful in 2m53s

This commit is contained in:
2026-09-17 13:49:05 -06:00
parent 2ef417e350
commit bc6ad686e1
3 changed files with 12 additions and 15 deletions
+6 -14
View File
@@ -1,32 +1,24 @@
#!/bin/bash
GITEA_OWNER_REPO="${1}"
DOCKERHUB_USERNAME="${1}"
DOCKERHUB_PASSWORD="${2}"
GITEA_API_KEY="${3}"
docker_username=pizza2da1
GITEA_OWNER_REPO="${3}"
GITEA_API_KEY="${4}"
gitea_username=$(echo "${GITEA_OWNER_REPO}" | sed 's/\/.*//')
repo_name=$(echo "${GITEA_OWNER_REPO}" | sed 's/^.*\///')
#gitea_username=pizza2d1
#repo_name=better_ripper
TOKEN=$(curl -s -X POST "https://hub.docker.com/v2/auth/token" \
NEW_DOCKERHUB_TOKEN=$(curl -s -X POST "https://hub.docker.com/v2/auth/token" \
-H "Content-Type: application/json" \
-d "{\"identifier\": \"${docker_username}\", \"secret\": \"${DOCKERHUB_PASSWORD}\"}" \
-d "{\"identifier\": \"${DOCKERHUB_USERNAME}\", \"secret\": \"${DOCKERHUB_PASSWORD}\"}" \
| jq -r .access_token)
echo
echo $TOKEN
echo ${gitea_username}
echo ${repo_name}
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\": \"${TOKEN}\",
\"data\": \"${NEW_DOCKERHUB_TOKEN}\",
\"description\": \"\"
}"