Attempt to fix workflow action
All checks were successful
Build for Releases / ensure-releases-exists-and-push-build (push) Successful in 8s

This commit is contained in:
Stephen Seo 2024-06-14 13:45:10 +09:00
parent dcd69f098f
commit 4a0a4bc1c3

View file

@ -7,13 +7,14 @@ jobs:
steps: steps:
- name: Get tags, release, and build - name: Get tags, release, and build
run: | run: |
THE_ACTION_WORKING_DIRECTORY="$(pwd)"
curl -X GET 'https://git.seodisparate.com/api/v1/repos/stephenseo/break_interval/tags' \ curl -X GET 'https://git.seodisparate.com/api/v1/repos/stephenseo/break_interval/tags' \
-H 'accept: application/json' | jq '.[].name' | tr -d '"' > tag_names -H 'accept: application/json' | jq '.[].name' | tr -d '"' > tag_names
for tag_name in $(cat tag_names); do for tag_name in $(cat tag_names); do
echo $tag_name echo $tag_name
curl -X GET "https://git.seodisparate.com/api/v1/repos/stephenseo/break_interval/releases/tags/$tag_name" \ curl -X GET "https://git.seodisparate.com/api/v1/repos/stephenseo/break_interval/releases/tags/$tag_name" \
-H "Authorization: token ${GITHUB_TOKEN}" \ -H "Authorization: token ${GITHUB_TOKEN}" \
-H 'accept: application/json' -o release_${tag_name}_check.json \ -H 'accept: application/json' -o "${THE_ACTION_WORKING_DIRECTORY}/release_${tag_name}_check.json" \
-w '%{http_code}' > release_${tag_name}_check_code -w '%{http_code}' > release_${tag_name}_check_code
test "404" = "$(cat release_${tag_name}_check_code)" && \ test "404" = "$(cat release_${tag_name}_check_code)" && \
curl --fail-with-body -X POST \ curl --fail-with-body -X POST \
@ -23,7 +24,7 @@ jobs:
-H 'Content-Type: application/json' \ -H 'Content-Type: application/json' \
-d "{ -d "{
\"name\": \"break_interval version ${tag_name}\", \"name\": \"break_interval version ${tag_name}\",
\"tag_name\": \"${tag_name}\" }" > release_${tag_name}_create.json && \ \"tag_name\": \"${tag_name}\" }" > "${THE_ACTION_WORKING_DIRECTORY}/release_${tag_name}_create.json" && \
(test -d "break_interval" || git clone --depth=1 --no-single-branch https://${GITHUB_TOKEN}@git.seodisparate.com/stephenseo/break_interval.git break_interval) && \ (test -d "break_interval" || git clone --depth=1 --no-single-branch https://${GITHUB_TOKEN}@git.seodisparate.com/stephenseo/break_interval.git break_interval) && \
pushd break_interval >&/dev/null && \ pushd break_interval >&/dev/null && \
git clean -xfd && git restore . && git checkout "${tag_name}" && \ git clean -xfd && git restore . && git checkout "${tag_name}" && \
@ -32,10 +33,10 @@ jobs:
cd buildRelease && strip --strip-unneeded break_interval && \ cd buildRelease && strip --strip-unneeded break_interval && \
zstd --ultra -20 break_interval -o break_interval_x86_64_${tag_name}.zst && \ zstd --ultra -20 break_interval -o break_interval_x86_64_${tag_name}.zst && \
curl --fail-with-body -X POST \ curl --fail-with-body -X POST \
"https://git.seodisparate.com/api/v1/repos/stephenseo/break_interval/releases/$(jq .id < release_${tag_name}_create.json)/assets" \ "https://git.seodisparate.com/api/v1/repos/stephenseo/break_interval/releases/$(jq .id < "${THE_ACTION_WORKING_DIRECTORY}/release_${tag_name}_create.json")/assets" \
-H 'accept: application/json' \ -H 'accept: application/json' \
-H "Authorization: token ${GITHUB_TOKEN}" \ -H "Authorization: token ${GITHUB_TOKEN}" \
-H 'Content-Type: multipart/form-data' \ -H 'Content-Type: multipart/form-data' \
-F "attachment=@break_interval_x86_64_${tag_name}.zst;type=application/zstd" > attach_${tag_name}.json -F "attachment=@break_interval_x86_64_${tag_name}.zst;type=application/zstd" > "${THE_ACTION_WORKING_DIRECTORY}/attach_${tag_name}.json"
while popd >&/dev/null; do echo -n; done while popd >&/dev/null; do echo -n; done
done done