2024-06-14 04:39:09 +00:00
|
|
|
name: Build for Releases
|
|
|
|
on: push
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
ensure-releases-exists-and-push-build:
|
|
|
|
runs-on: any_archLinux
|
|
|
|
steps:
|
|
|
|
- name: Get tags, release, and build
|
|
|
|
run: |
|
2024-06-14 04:45:10 +00:00
|
|
|
THE_ACTION_WORKING_DIRECTORY="$(pwd)"
|
2024-06-14 04:39:09 +00:00
|
|
|
curl -X GET 'https://git.seodisparate.com/api/v1/repos/stephenseo/break_interval/tags' \
|
|
|
|
-H 'accept: application/json' | jq '.[].name' | tr -d '"' > tag_names
|
|
|
|
for tag_name in $(cat tag_names); do
|
|
|
|
echo $tag_name
|
|
|
|
curl -X GET "https://git.seodisparate.com/api/v1/repos/stephenseo/break_interval/releases/tags/$tag_name" \
|
|
|
|
-H "Authorization: token ${GITHUB_TOKEN}" \
|
2024-06-14 04:45:10 +00:00
|
|
|
-H 'accept: application/json' -o "${THE_ACTION_WORKING_DIRECTORY}/release_${tag_name}_check.json" \
|
2024-06-14 04:39:09 +00:00
|
|
|
-w '%{http_code}' > release_${tag_name}_check_code
|
|
|
|
test "404" = "$(cat release_${tag_name}_check_code)" && \
|
|
|
|
curl --fail-with-body -X POST \
|
|
|
|
"https://git.seodisparate.com/api/v1/repos/stephenseo/break_interval/releases" \
|
|
|
|
-H 'accept: application/json' \
|
|
|
|
-H "Authorization: token ${GITHUB_TOKEN}" \
|
|
|
|
-H 'Content-Type: application/json' \
|
|
|
|
-d "{
|
|
|
|
\"name\": \"break_interval version ${tag_name}\",
|
2024-06-14 04:45:10 +00:00
|
|
|
\"tag_name\": \"${tag_name}\" }" > "${THE_ACTION_WORKING_DIRECTORY}/release_${tag_name}_create.json" && \
|
2024-06-14 04:39:09 +00:00
|
|
|
(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 && \
|
|
|
|
git clean -xfd && git restore . && git checkout "${tag_name}" && \
|
|
|
|
cmake -S . -B buildRelease -DCMAKE_BUILD_TYPE=Release && \
|
|
|
|
make -C buildRelease && \
|
|
|
|
cd buildRelease && strip --strip-unneeded break_interval && \
|
|
|
|
zstd --ultra -20 break_interval -o break_interval_x86_64_${tag_name}.zst && \
|
|
|
|
curl --fail-with-body -X POST \
|
2024-06-14 04:45:10 +00:00
|
|
|
"https://git.seodisparate.com/api/v1/repos/stephenseo/break_interval/releases/$(jq .id < "${THE_ACTION_WORKING_DIRECTORY}/release_${tag_name}_create.json")/assets" \
|
2024-06-14 04:39:09 +00:00
|
|
|
-H 'accept: application/json' \
|
|
|
|
-H "Authorization: token ${GITHUB_TOKEN}" \
|
|
|
|
-H 'Content-Type: multipart/form-data' \
|
2024-06-14 04:45:10 +00:00
|
|
|
-F "attachment=@break_interval_x86_64_${tag_name}.zst;type=application/zstd" > "${THE_ACTION_WORKING_DIRECTORY}/attach_${tag_name}.json"
|
2024-06-14 04:39:09 +00:00
|
|
|
while popd >&/dev/null; do echo -n; done
|
|
|
|
done
|