Files
bongo/.gitea/workflows/debian-trixie.yml
T
Mario Fetka a2ba85c2e1
Debian Trixie package bundle / packages (push) Successful in 14m39s
Remove unsupported Gitea artifact upload
2026-07-21 04:51:53 +02:00

111 lines
3.8 KiB
YAML

name: Debian Trixie package bundle
on:
workflow_dispatch:
push:
branches:
- master
paths:
- ".gitea/workflows/debian-trixie.yml"
- "contrib/debian/**"
- "debian/**"
- "cmake/**"
- "src/**"
- "CMakeLists.txt"
jobs:
packages:
runs-on: ubuntu-latest
container:
image: debian:trixie
env:
GITEA_API: https://gitea.disconnected-by-peer.at/api/v1
OWNER: geos_one
REPO: bongo
defaults:
run:
shell: bash
steps:
- name: Bootstrap checkout requirements
run: |
apt-get update
apt-get install -y --no-install-recommends \
ca-certificates curl git jq nodejs
- name: Check out Bongo
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Build patched dependencies and Bongo
run: |
chmod +x contrib/debian/build-trixie-bundle.sh
contrib/debian/build-trixie-bundle.sh \
"$GITHUB_WORKSPACE" "$RUNNER_TEMP/bongo-trixie"
- name: Find development bundle
id: bundle
run: |
set -eu
short_sha="$(git rev-parse --short=7 HEAD)"
file="$(find "$RUNNER_TEMP/bongo-trixie" -maxdepth 1 -type f \
-name "bongo-*-dev${short_sha}-debian-trixie.zip" -print)"
test -f "$file"
echo "file=$file" >> "$GITHUB_OUTPUT"
echo "name=$(basename "$file")" >> "$GITHUB_OUTPUT"
- name: Create or update development release
env:
GITEA_TOKEN: ${{ secrets.RELEASE_TOKEN }}
REF_NAME: ${{ gitea.ref_name || github.ref_name }}
run: |
set -eu
short_sha="$(git rev-parse --short=7 HEAD)"
release_json="$(curl -fsS \
-H "Authorization: token ${GITEA_TOKEN}" \
"${GITEA_API}/repos/${OWNER}/${REPO}/releases/tags/development" || true)"
payload="$(jq -n \
--arg tag development \
--arg name "development (${REF_NAME} @ ${short_sha})" \
'{tag_name:$tag,name:$name,draft:false,prerelease:true}')"
if [ -z "$release_json" ]; then
release_json="$(curl -fsS -X POST \
-H "Authorization: token ${GITEA_TOKEN}" \
-H "Content-Type: application/json" \
-d "$payload" \
"${GITEA_API}/repos/${OWNER}/${REPO}/releases")"
else
release_id="$(printf '%s' "$release_json" | jq -r '.id')"
release_json="$(curl -fsS -X PATCH \
-H "Authorization: token ${GITEA_TOKEN}" \
-H "Content-Type: application/json" \
-d "$payload" \
"${GITEA_API}/repos/${OWNER}/${REPO}/releases/${release_id}")"
fi
printf '%s\n' "$release_json" > release.json
- name: Replace development assets
env:
GITEA_TOKEN: ${{ secrets.RELEASE_TOKEN }}
FILE: ${{ steps.bundle.outputs.file }}
NAME: ${{ steps.bundle.outputs.name }}
run: |
set -eu
release_id="$(jq -r '.id' release.json)"
curl -fsS \
-H "Authorization: token ${GITEA_TOKEN}" \
"${GITEA_API}/repos/${OWNER}/${REPO}/releases/${release_id}" \
| jq -r '.assets[]? | .id' \
| while read -r asset_id; do
[ -n "$asset_id" ] || continue
curl -fsS -X DELETE \
-H "Authorization: token ${GITEA_TOKEN}" \
"${GITEA_API}/repos/${OWNER}/${REPO}/releases/${release_id}/assets/${asset_id}"
done
curl -fsS -X POST \
-H "Authorization: token ${GITEA_TOKEN}" \
-H "Content-Type: application/octet-stream" \
--data-binary @"${FILE}" \
"${GITEA_API}/repos/${OWNER}/${REPO}/releases/${release_id}/assets?name=${NAME}"