2024-06-14 04:39:09 +00:00
|
|
|
name: Build for Releases
|
2024-06-14 12:06:53 +00:00
|
|
|
on:
|
|
|
|
push:
|
|
|
|
tags:
|
|
|
|
- '*'
|
2024-06-14 04:39:09 +00:00
|
|
|
|
|
|
|
jobs:
|
2024-06-14 12:06:53 +00:00
|
|
|
ensure-release-exists:
|
2024-06-14 04:39:09 +00:00
|
|
|
runs-on: any_archLinux
|
|
|
|
steps:
|
2024-06-14 12:06:53 +00:00
|
|
|
- name: Check release and create if it doesn't exist
|
2024-06-14 04:39:09 +00:00
|
|
|
run: |
|
2024-06-14 04:45:10 +00:00
|
|
|
THE_ACTION_WORKING_DIRECTORY="$(pwd)"
|
2024-06-14 12:06:53 +00:00
|
|
|
curl -X GET "https://git.seodisparate.com/api/v1/repos/stephenseo/break_interval/releases/tags/$GITHUB_REF_NAME" \
|
|
|
|
-H "Authorization: token ${GITHUB_TOKEN}" \
|
|
|
|
-H 'accept: application/json' -o "${THE_ACTION_WORKING_DIRECTORY}/release_${GITHUB_REF_NAME}_check.json" \
|
2024-06-14 12:15:07 +00:00
|
|
|
-w '%{http_code}' 2>/dev/null > release_${GITHUB_REF_NAME}_check_code
|
2024-06-14 12:06:53 +00:00
|
|
|
if [[ "404" == "$(cat release_${GITHUB_REF_NAME}_check_code)" ]]; then
|
2024-06-14 04:39:09 +00:00
|
|
|
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 "{
|
2024-06-14 12:06:53 +00:00
|
|
|
\"name\": \"break_interval version ${GITHUB_REF_NAME}\",
|
2024-06-14 12:15:07 +00:00
|
|
|
\"tag_name\": \"${GITHUB_REF_NAME}\" }" 2>/dev/null > "${THE_ACTION_WORKING_DIRECTORY}/release_${GITHUB_REF_NAME}_create.json"
|
2024-06-14 12:06:53 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
ensure-releases-exists-and-push-build-x86_64:
|
|
|
|
needs: ensure-release-exists
|
2024-06-15 02:13:53 +00:00
|
|
|
runs-on: x86_64_archLinux
|
2024-06-14 12:06:53 +00:00
|
|
|
steps:
|
|
|
|
- name: Check release assets and build for x86_64
|
|
|
|
run: |
|
|
|
|
THE_ACTION_WORKING_DIRECTORY="$(pwd)"
|
|
|
|
BUILD_ASSET_NAME="break_interval_x86_64_${GITHUB_REF_NAME}.zst"
|
|
|
|
curl -X GET \
|
|
|
|
"https://git.seodisparate.com/api/v1/repos/stephenseo/break_interval/releases/tags/${GITHUB_REF_NAME}" \
|
|
|
|
-H 'accept: application/json' -o "${THE_ACTION_WORKING_DIRECTORY}/release_info.json" 2>/dev/null
|
|
|
|
BUILD_ASSET_EXISTS=0
|
2024-06-14 12:12:32 +00:00
|
|
|
for asset in $(jq '.assets.[].name' < "${THE_ACTION_WORKING_DIRECTORY}/release_info.json"); do
|
2024-06-14 12:06:53 +00:00
|
|
|
if [[ "$asset" == "$BUILD_ASSET_NAME" ]]; then
|
|
|
|
BUILD_ASSET_EXISTS=1
|
|
|
|
break
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
if ! (( BUILD_ASSET_EXISTS )); then
|
|
|
|
if ! [[ -d "break_interval_clone" ]]; then
|
|
|
|
git clone --depth=1 --no-single-branch https://git.seodisparate.com/stephenseo/break_interval.git break_interval_clone
|
|
|
|
fi
|
|
|
|
pushd break_interval_clone >&/dev/null
|
|
|
|
git clean -xfd && git restore . && git checkout "${GITHUB_REF_NAME}"
|
|
|
|
cmake -S . -B buildRelease -DCMAKE_BUILD_TYPE=Release
|
|
|
|
make -C buildRelease
|
|
|
|
strip --strip-unneeded buildRelease/break_interval
|
|
|
|
zstd --ultra -20 buildRelease/break_interval -o "${THE_ACTION_WORKING_DIRECTORY}/${BUILD_ASSET_NAME}"
|
2024-06-15 03:45:53 +00:00
|
|
|
curl --fail-with-body -X GET \
|
|
|
|
"https://git.seodisparate.com/api/v1/repos/stephenseo/break_interval/releases/$(jq .id < "${THE_ACTION_WORKING_DIRECTORY}/release_info.json")" \
|
|
|
|
-H 'accept: application/json' -o "${THE_ACTION_WORKING_DIRECTORY}/current_release_info.json" 2>/dev/null
|
|
|
|
curl --fail-with-body -X PATCH \
|
|
|
|
"https://git.seodisparate.com/api/v1/repos/stephenseo/break_interval/releases/$(jq .id < "${THE_ACTION_WORKING_DIRECTORY}/release_info.json")" \
|
|
|
|
-H 'accept: application/json' \
|
|
|
|
-H "Authorization: token ${GITHUB_TOKEN}" \
|
|
|
|
-H 'Content-Type: application/json' \
|
|
|
|
-d "{
|
|
|
|
\"body\": \"$(jq .body < "${THE_ACTION_WORKING_DIRECTORY}/current_release_info.json" | sed -e 's/^"//' -e 's/"$//')
|
|
|
|
SHA256SUM $(find "${THE_ACTION_WORKING_DIRECTORY}" -maxdepth 1 -name "*${BUILD_ASSET_NAME}" -execdir sha256sum '{}' ';')\"
|
|
|
|
}" >&/dev/null
|
2024-06-14 04:39:09 +00:00
|
|
|
curl --fail-with-body -X POST \
|
2024-06-14 12:06:53 +00:00
|
|
|
"https://git.seodisparate.com/api/v1/repos/stephenseo/break_interval/releases/$(jq .id < "${THE_ACTION_WORKING_DIRECTORY}/release_info.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-15 03:45:53 +00:00
|
|
|
-F "attachment=@${THE_ACTION_WORKING_DIRECTORY}/${BUILD_ASSET_NAME};type=application/zstd" > "${THE_ACTION_WORKING_DIRECTORY}/attach_${GITHUB_REF_NAME}.json" 2>/dev/null
|
2024-06-14 12:06:53 +00:00
|
|
|
popd >&/dev/null
|
|
|
|
fi
|
|
|
|
|
|
|
|
ensure-releases-exists-and-push-build-aarch64:
|
|
|
|
needs: ensure-release-exists
|
|
|
|
runs-on: aarch64_archLinux
|
|
|
|
steps:
|
|
|
|
- name: Check release assets and build for aarch64
|
|
|
|
run: |
|
|
|
|
THE_ACTION_WORKING_DIRECTORY="$(pwd)"
|
|
|
|
BUILD_ASSET_NAME="break_interval_aarch64_${GITHUB_REF_NAME}.zst"
|
|
|
|
curl -X GET \
|
|
|
|
"https://git.seodisparate.com/api/v1/repos/stephenseo/break_interval/releases/tags/${GITHUB_REF_NAME}" \
|
|
|
|
-H 'accept: application/json' -o "${THE_ACTION_WORKING_DIRECTORY}/release_info.json" 2>/dev/null
|
|
|
|
BUILD_ASSET_EXISTS=0
|
2024-06-14 12:12:32 +00:00
|
|
|
for asset in $(jq '.assets.[].name' < "${THE_ACTION_WORKING_DIRECTORY}/release_info.json"); do
|
2024-06-14 12:06:53 +00:00
|
|
|
if [[ "$asset" == "$BUILD_ASSET_NAME" ]]; then
|
|
|
|
BUILD_ASSET_EXISTS=1
|
|
|
|
break
|
|
|
|
fi
|
2024-06-14 04:39:09 +00:00
|
|
|
done
|
2024-06-14 12:06:53 +00:00
|
|
|
if ! (( BUILD_ASSET_EXISTS )); then
|
|
|
|
if ! [[ -d "break_interval_clone" ]]; then
|
|
|
|
git clone --depth=1 --no-single-branch https://git.seodisparate.com/stephenseo/break_interval.git break_interval_clone
|
|
|
|
fi
|
|
|
|
pushd break_interval_clone >&/dev/null
|
|
|
|
git clean -xfd && git restore . && git checkout "${GITHUB_REF_NAME}"
|
|
|
|
cmake -S . -B buildRelease -DCMAKE_BUILD_TYPE=Release
|
|
|
|
make -C buildRelease
|
|
|
|
strip --strip-unneeded buildRelease/break_interval
|
|
|
|
zstd --ultra -20 buildRelease/break_interval -o "${THE_ACTION_WORKING_DIRECTORY}/${BUILD_ASSET_NAME}"
|
2024-06-15 03:45:53 +00:00
|
|
|
curl --fail-with-body -X GET \
|
|
|
|
"https://git.seodisparate.com/api/v1/repos/stephenseo/break_interval/releases/$(jq .id < "${THE_ACTION_WORKING_DIRECTORY}/release_info.json")" \
|
|
|
|
-H 'accept: application/json' -o "${THE_ACTION_WORKING_DIRECTORY}/current_release_info.json" 2>/dev/null
|
|
|
|
curl --fail-with-body -X PATCH \
|
|
|
|
"https://git.seodisparate.com/api/v1/repos/stephenseo/break_interval/releases/$(jq .id < "${THE_ACTION_WORKING_DIRECTORY}/release_info.json")" \
|
|
|
|
-H 'accept: application/json' \
|
|
|
|
-H "Authorization: token ${GITHUB_TOKEN}" \
|
|
|
|
-H 'Content-Type: application/json' \
|
|
|
|
-d "{
|
|
|
|
\"body\": \"$(jq .body < "${THE_ACTION_WORKING_DIRECTORY}/current_release_info.json" | sed -e 's/^"//' -e 's/"$//')
|
|
|
|
SHA256SUM $(find "${THE_ACTION_WORKING_DIRECTORY}" -maxdepth 1 -name "*${BUILD_ASSET_NAME}" -execdir sha256sum '{}' ';')\"
|
|
|
|
}" >&/dev/null
|
2024-06-14 12:06:53 +00:00
|
|
|
curl --fail-with-body -X POST \
|
|
|
|
"https://git.seodisparate.com/api/v1/repos/stephenseo/break_interval/releases/$(jq .id < "${THE_ACTION_WORKING_DIRECTORY}/release_info.json")/assets" \
|
|
|
|
-H 'accept: application/json' \
|
|
|
|
-H "Authorization: token ${GITHUB_TOKEN}" \
|
|
|
|
-H 'Content-Type: multipart/form-data' \
|
2024-06-15 03:45:53 +00:00
|
|
|
-F "attachment=@${THE_ACTION_WORKING_DIRECTORY}/${BUILD_ASSET_NAME};type=application/zstd" > "${THE_ACTION_WORKING_DIRECTORY}/attach_${GITHUB_REF_NAME}.json" 2>/dev/null
|
2024-06-14 12:06:53 +00:00
|
|
|
popd >&/dev/null
|
|
|
|
fi
|