Added docker image files
This commit is contained in:
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