Trying with tag and uploading release
Build Packages / Build (push) Failing after 29s

This commit is contained in:
2026-04-08 13:32:09 +02:00
parent 959636cbc3
commit a7b81b7db0
+58 -1
View File
@@ -19,4 +19,61 @@ jobs:
mkdir -p build
cd build
cmake -DCMAKE_BUILD_TYPE=Release ..
make -j
make -j
- name: Upload release asset to Gitea
if: github.ref_type == 'tag'
shell: bash
env:
GITEA_TOKEN: ${{ secrets.GITEA_RELEASE_TOKEN }}
GITEA_SERVER: ${{ github.server_url }}
REPO: ${{ github.repository }}
TAG: ${{ github.ref_name }}
run: |
set -euo pipefail
file="build/libdurin-plugin.so"
if [ ! -f "$file" ]; then
echo "Release asset not found: $file"
exit 1
fi
api="${GITEA_SERVER}/api/v1/repos/${REPO}"
release_json="$(curl -fsS \
-H "Authorization: token ${GITEA_TOKEN}" \
"${api}/releases/tags/${TAG}" || true)"
if [ -z "${release_json}" ] || [ "${release_json}" = "null" ]; then
echo "Release for tag ${TAG} does not exist, creating it"
release_json="$(curl -fsS \
-X POST \
-H "Authorization: token ${GITEA_TOKEN}" \
-H "Content-Type: application/json" \
"${api}/releases" \
-d "{
\"tag_name\": \"${TAG}\",
\"name\": \"${TAG}\",
\"draft\": false,
\"prerelease\": false
}")"
else
echo "Release for tag ${TAG} already exists"
fi
release_id="$(printf '%s' "${release_json}" | sed -n 's/.*"id":[[:space:]]*\([0-9][0-9]*\).*/\1/p' | head -n1)"
if [ -z "${release_id}" ]; then
echo "Failed to determine release id"
echo "${release_json}"
exit 1
fi
asset_name="$(basename "${file}")"
echo "Uploading ${asset_name} to release ${release_id}"
curl -fsS \
-X POST \
-H "Authorization: token ${GITEA_TOKEN}" \
-F "attachment=@${file}" \
-F "name=${asset_name}" \
"${api}/releases/${release_id}/assets"