Remove the usage of docker
This commit is contained in:
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
.idea
|
||||||
30
action.yml
30
action.yml
@@ -22,6 +22,30 @@ runs:
|
|||||||
- name: Docker login
|
- name: Docker login
|
||||||
shell: sh
|
shell: sh
|
||||||
run: |
|
run: |
|
||||||
export PREFIXLESS_REGISTRY=$(echo "${{ inputs.registry }}" | sed 's/^https\?:\/\///')
|
export PREFIXLESS_REGISTRY=$(echo -n "${{ inputs.registry }}" | sed 's/^https\?:\/\///')
|
||||||
echo "${{ inputs.pass }}" | docker login "$PREFIXLESS_REGISTRY" -u ${{ inputs.user }} --password-stdin
|
|
||||||
echo "DOCKER_CONFIG_BASE64=$(base64 -w 0 < "$HOME/.docker/config.json")" >> $GITEA_ENV
|
echo Checking credentials validity for ${PREFIXLESS_REGISTRY}...
|
||||||
|
export BASE64_AUTH=$(echo -n "${{ inputs.user }}:${{ inputs.pass }}" | base64 -w 0)
|
||||||
|
|
||||||
|
response=$(curl -s -w "\n%{http_code}" \
|
||||||
|
-H "Authorization: Basic $BASE64_AUTH" \
|
||||||
|
-H "User-Agent: Docker-Client/20.10.12 (linux)" \
|
||||||
|
"https://${PREFIXLESS_REGISTRY}/v2/")
|
||||||
|
|
||||||
|
http_code=$(echo "$response" | tail -n 1)
|
||||||
|
response_body=$(echo "$response" | head -n -1)
|
||||||
|
|
||||||
|
if [ "$http_code" -eq 200 ]; then
|
||||||
|
echo "Authentication successful"
|
||||||
|
else
|
||||||
|
echo "Authentication failed with HTTP code: $http_code"
|
||||||
|
echo "Response body:"
|
||||||
|
echo "$response_body"
|
||||||
|
if [ "$http_code" -eq 401 ]; then
|
||||||
|
echo "The identifiers are probably wrong"
|
||||||
|
fi
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Exporting config"
|
||||||
|
echo DOCKER_CONFIG_BASE64=$(echo "{\"auths\": {\"${PREFIXLESS_REGISTRY}\": {\"auth\": \"${BASE64_AUTH}\"}}}" | base64 -w 0) >> $GITEA_ENV
|
||||||
|
|||||||
Reference in New Issue
Block a user