test github...

This commit is contained in:
Chl 2024-08-30 19:42:51 +02:00
parent c9142d952c
commit 1dc2cb5cad

View file

@ -73,24 +73,16 @@ runs:
$( echo "$ACTIONS_RUNTIME_TOKEN" | sed 's/.*\.\(.*\)\..*/\1/' | base64 -d 2>/dev/null | sed 's/.*Actions.Results:\([^:]\+\):\([^:" ]\+\).*/\1 \2/' ) $( echo "$ACTIONS_RUNTIME_TOKEN" | sed 's/.*\.\(.*\)\..*/\1/' | base64 -d 2>/dev/null | sed 's/.*Actions.Results:\([^:]\+\):\([^:" ]\+\).*/\1 \2/' )
EOF EOF
echo "p'tit test"
echo "$ACTIONS_RUNTIME_TOKEN" | base64
echo "$GITHUB_TOKEN" | base64
# Request an upload URL # Request an upload URL
RESPONSE="$( wget -O - \ RESPONSE="$( wget -O - \
--header 'Content-Type:application/json' \ --header 'Content-Type:application/json' \
--header "Authorization: Bearer $ACTIONS_RUNTIME_TOKEN" \ --header "Authorization: Bearer $ACTIONS_RUNTIME_TOKEN" \
--header 'User-Agent: @actions/artifact-2.1.9' \
--header "Date: $( date --rfc-email --utc | sed 's/+0000$/GMT/' )" \
--header "X-Github-Backend: Kubernetes" \
--header "X-Github-Request-Id: E402:16E100:624E20:7C3AE0:$( dd if=/dev/random bs=1 count=4 2>/dev/null | hexdump -e '"%X"' )" \
--post-data "$( printf '{"version":4, "name":"%s", "workflow_run_backend_id":"%s", "workflow_job_run_backend_id":"%s"}' "${{ inputs.name }}" "$WORKFLOW_RUN_BACKEND_ID" "$WORKFLOW_JOB_RUN_BACKEND_ID" )" \ --post-data "$( printf '{"version":4, "name":"%s", "workflow_run_backend_id":"%s", "workflow_job_run_backend_id":"%s"}' "${{ inputs.name }}" "$WORKFLOW_RUN_BACKEND_ID" "$WORKFLOW_JOB_RUN_BACKEND_ID" )" \
"https://results-receiver.actions.githubusercontent.com/twirp/github.actions.results.api.v1.ArtifactService/CreateArtifact" "https://results-receiver.actions.githubusercontent.com/twirp/github.actions.results.api.v1.ArtifactService/CreateArtifact"
)" )"
# We get a JSON with an signedUploadUrl similar to : # We get a JSON with an signedUploadUrl similar to :
# https://entrepot.xlii.si/twirp/github.actions.results.api.v1.ArtifactService/UploadArtifact?sig=yWWEI8tIIECp8D7E5TVh4_6G2pZxWaVdQcSYaCsx5s0=&expires=2024-08-26+07%3A20%3A49.886890537+%2B0200+CEST&artifactName=mymodule-1.2.3.zip&taskID=63 # https://entrepot.xlii.si/twirp/github.actions.results.api.v1.ArtifactService/UploadArtifact?sig=yWWEI8tIIECp8D7E5TVh4_6G2pZxWaVdQcSYaCsx5s0=&expires=2024-08-26+07%3A20%3A49.886890537+%2B0200+CEST&artifactName=mymodule-1.2.3.zip&taskID=63
SIGNED_UPLOAD_URL="$( echo "$RESPONSE" | sed -n 's/.*"signedUploadUrl" *: *"\([^"]\+\)".*/\1/p' )" SIGNED_UPLOAD_URL="$( echo "$RESPONSE" | sed -n 's/.*"signed_?[uU]pload_?[uU]rl" *: *"\([^"]\+\)".*/\1/p' )"
# Upload our file # Upload our file
# (note: adding '&comp=block' at the end of the URL) # (note: adding '&comp=block' at the end of the URL)
@ -102,7 +94,7 @@ runs:
# Finalize the artifact # Finalize the artifact
RESPONSE="$( wget -O - \ RESPONSE="$( wget -O - \
--header 'Content-Type:application/json' \ --header 'Content-Type:application/json' \
--header "Authorization: Bearer $GITHUB_TOKEN" \ --header "Authorization: Bearer $ACTIONS_RUNTIME_TOKEN" \
--post-data "$( printf '{"hash":"sha256:%s", "name":"%s", "size":"%d", "workflow_run_backend_id":"%s", "workflow_job_run_backend_id":"%s"}' "$( sha256sum $MYUPLOAD | sed 's/[[:space:]]\+.*//' )" "${{ inputs.name }}" "$( stat -c %s $MYUPLOAD )" "$WORKFLOW_RUN_BACKEND_ID" "$WORKFLOW_JOB_RUN_BACKEND_ID" )" \ --post-data "$( printf '{"hash":"sha256:%s", "name":"%s", "size":"%d", "workflow_run_backend_id":"%s", "workflow_job_run_backend_id":"%s"}' "$( sha256sum $MYUPLOAD | sed 's/[[:space:]]\+.*//' )" "${{ inputs.name }}" "$( stat -c %s $MYUPLOAD )" "$WORKFLOW_RUN_BACKEND_ID" "$WORKFLOW_JOB_RUN_BACKEND_ID" )" \
"$GITHUB_SERVER_URL"/twirp/github.actions.results.api.v1.ArtifactService/FinalizeArtifact "$GITHUB_SERVER_URL"/twirp/github.actions.results.api.v1.ArtifactService/FinalizeArtifact
)" )"