diff --git a/.gitea/workflows/release.yml b/.gitea/workflows/release.yml index d07ea36..7504324 100644 --- a/.gitea/workflows/release.yml +++ b/.gitea/workflows/release.yml @@ -10,6 +10,7 @@ jobs: runs-on: ubuntu-latest env: HW_TOKEN: ${{ secrets.HW_RELEASE_TOKEN }} + HW_API: https://git.wlkns.org/api/v1/repos/wlkns-dev/hoerwerk steps: - name: Checkout uses: actions/checkout@v4 @@ -34,33 +35,46 @@ jobs: npm install npm run tauri build -- --bundles appimage,deb - - name: Release anlegen/ermitteln + - name: Release anhängen (deb + AppImage) run: | - VER=${GITHUB_REF_NAME} - API="https://git.wlkns.org/api/v1/repos/wlkns-dev/hoerwerk" - curl -sf -X POST \ - -H "Authorization: token $HW_TOKEN" \ - -H 'Content-Type: application/json' \ - -d "{\"tag_name\":\"$VER\",\"name\":\"Hörwerk $VER\",\"body\":\"Release $VER\",\"draft\":false,\"prerelease\":false}" \ - "$API/releases" > /tmp/rel.json || true - RID=$(cat /tmp/rel.json | python3 -c 'import json,sys; print(json.load(sys.stdin).get("id",""))' 2>/dev/null || echo) - if [ -z "$RID" ]; then - curl -sf -H "Authorization: token $HW_TOKEN" "$API/releases/tags/$VER" > /tmp/rel.json - RID=$(python3 -c 'import json,sys; print(json.load(sys.stdin)["id"])') - fi - echo "RELEASE_ID=$RID" >> "$GITHUB_ENV" + VER="$GITHUB_REF_NAME" + set -u + + post_release() { + curl -sS -X POST \ + -H "Authorization: token $HW_TOKEN" \ + -H 'Content-Type: application/json' \ + -d "{\"tag_name\":\"$VER\",\"name\":\"Hörwerk $VER\",\"body\":\"Release $VER — AppImage, deb und Arch-Paket.\",\"draft\":false,\"prerelease\":false}" \ + -w '\n%{http_code}' \ + -o /tmp/hw-rel-body.json \ + "$HW_API/releases" + } + get_release() { + curl -sS -H "Authorization: token $HW_TOKEN" \ + -w '\n%{http_code}' -o /tmp/hw-rel-body.json \ + "$HW_API/releases/tags/$VER" + } + + code=$(post_release | tail -n1) + RID=$(grep -o '"id": *[0-9]*' /tmp/hw-rel-body.json | head -n1 | grep -o '[0-9]*') + if [ -z "$RID" ] && [ "$code" != "201" ]; then + get_release >/dev/null + RID=$(grep -o '"id": *[0-9]*' /tmp/hw-rel-body.json | head -n1 | grep -o '[0-9]*') + fi + if [ -z "$RID" ]; then + echo "Release-ID konnte nicht ermittelt werden (code=$code)" + exit 1 + fi + echo "Release-ID: $RID" - - name: Anhängen (deb + AppImage) - env: - RELEASE_ID: ${{ env.RELEASE_ID }} - run: | - API="https://git.wlkns.org/api/v1/repos/wlkns-dev/hoerwerk" for f in src-tauri/target/release/bundle/appimage/*.AppImage src-tauri/target/release/bundle/deb/*.deb; do echo "Lade $(basename "$f") hoch…" - curl -sf -X POST \ - -H "Authorization: token $HW_TOKEN" \ + c=$(curl -sS -X POST -H "Authorization: token $HW_TOKEN" \ -F "attachment=@$f" \ - "$API/releases/$RELEASE_ID/assets?name=$(basename "$f")" + -o /tmp/hw-upload.json -w '%{http_code}' \ + "$HW_API/releases/$RID/assets?name=$(basename "$f")") + echo " Upload-Code: $c" + case "$c" in 200|201) echo " ok";; *) cat /tmp/hw-upload.json; exit 1;; esac done build-pacman: @@ -68,6 +82,7 @@ jobs: runs-on: arch-base-devel env: HW_TOKEN: ${{ secrets.HW_RELEASE_TOKEN }} + HW_API: https://git.wlkns.org/api/v1/repos/wlkns-dev/hoerwerk steps: - name: Abhängigkeiten (root) run: | @@ -85,30 +100,44 @@ jobs: chown -R builder:builder .. sudo -u builder env HOME=/home/builder makepkg -f --noconfirm - - name: Release anlegen/ermitteln + - name: Release anhängen (pacman) run: | - VER=${GITHUB_REF_NAME} - API="https://git.wlkns.org/api/v1/repos/wlkns-dev/hoerwerk" - curl -sf -X POST \ - -H "Authorization: token $HW_TOKEN" \ - -H 'Content-Type: application/json' \ - -d "{\"tag_name\":\"$VER\",\"name\":\"Hörwerk $VER\",\"body\":\"Release $VER\",\"draft\":false,\"prerelease\":false}" \ - "$API/releases" > /tmp/rel2.json || true - RID=$(cat /tmp/rel2.json | python3 -c 'import json,sys; print(json.load(sys.stdin).get("id",""))' 2>/dev/null || echo) - if [ -z "$RID" ]; then - curl -sf -H "Authorization: token $HW_TOKEN" "$API/releases/tags/$VER" > /tmp/rel2.json - RID=$(python3 -c 'import json,sys; print(json.load(sys.stdin)["id"])') - fi - echo "RELEASE_ID=$RID" >> "$GITHUB_ENV" + VER="$GITHUB_REF_NAME" + set -u - - name: Anhängen (pacman) - env: - RELEASE_ID: ${{ env.RELEASE_ID }} - run: | - API="https://git.wlkns.org/api/v1/repos/wlkns-dev/hoerwerk" - f=$(find . -name "hoerwerk-*.pkg.tar.zst" -type f | head -1) + post_release() { + curl -sS -X POST \ + -H "Authorization: token $HW_TOKEN" \ + -H 'Content-Type: application/json' \ + -d "{\"tag_name\":\"$VER\",\"name\":\"Hörwerk $VER\",\"body\":\"Release $VER — AppImage, deb und Arch-Paket.\",\"draft\":false,\"prerelease\":false}" \ + -w '\n%{http_code}' \ + -o /tmp/hw-rel-body2.json \ + "$HW_API/releases" + } + get_release() { + curl -sS -H "Authorization: token $HW_TOKEN" \ + -w '\n%{http_code}' -o /tmp/hw-rel-body2.json \ + "$HW_API/releases/tags/$VER" + } + + code=$(post_release | tail -n1) + RID=$(grep -o '"id": *[0-9]*' /tmp/hw-rel-body2.json | head -n1 | grep -o '[0-9]*') + if [ -z "$RID" ] && [ "$code" != "201" ]; then + get_release >/dev/null + RID=$(grep -o '"id": *[0-9]*' /tmp/hw-rel-body2.json | head -n1 | grep -o '[0-9]*') + fi + if [ -z "$RID" ]; then + echo "Release-ID konnte nicht ermittelt werden (code=$code)" + exit 1 + fi + echo "Release-ID: $RID" + + f=$(find "$PWD" -name "hoerwerk-*.pkg.tar.zst" -type f | head -n1) + [ -n "$f" ] || { echo "kein pkg.tar.zst gefunden"; exit 1; } echo "Lade $(basename "$f") hoch…" - curl -sf -X POST \ - -H "Authorization: token $HW_TOKEN" \ + c=$(curl -sS -X POST -H "Authorization: token $HW_TOKEN" \ -F "attachment=@$f" \ - "$API/releases/$RELEASE_ID/assets?name=$(basename "$f")" + -o /tmp/hw-upload2.json -w '%{http_code}' \ + "$HW_API/releases/$RID/assets?name=$(basename "$f")") + echo "Upload-Code: $c" + case "$c" in 200|201) echo ok;; *) cat /tmp/hw-upload2.json; exit 1;; esac diff --git a/package.json b/package.json index 0a977f4..6a7fb0e 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "hoerwerk", "private": true, - "version": "0.1.3", + "version": "0.1.4", "description": "Hörwerk – lokaler Audible-Hörbuch-Player", "type": "module", "scripts": { diff --git a/packaging/arch/PKGBUILD b/packaging/arch/PKGBUILD index 568a87b..cba13b9 100644 --- a/packaging/arch/PKGBUILD +++ b/packaging/arch/PKGBUILD @@ -1,6 +1,6 @@ # Maintainer: Stephan Wilkens pkgname=hoerwerk -pkgver=0.1.3 +pkgver=0.1.4 pkgrel=1 pkgdesc='Lokaler Hörbuch-Player für die eigene Audible-Bibliothek (Tauri 2 + Svelte)' arch=('x86_64') diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index 42d54f6..8a4500d 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "hoerwerk" -version = "0.1.3" +version = "0.1.4" description = "Hörwerk – lokaler Audible-Hörbuch-Player" authors = ["Stephan"] edition = "2024" diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index 91f2150..1f6905d 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -1,7 +1,7 @@ { "$schema": "https://schema.tauri.app/config/2", "productName": "hoerwerk", - "version": "0.1.3", + "version": "0.1.4", "identifier": "com.hoerwerk.app", "build": { "beforeDevCommand": "npm run dev", diff --git a/src/App.svelte b/src/App.svelte index 7121205..98ff0bb 100644 --- a/src/App.svelte +++ b/src/App.svelte @@ -893,5 +893,5 @@ {#if error} {error} {/if} - Hörwerk 0.1.3 + Hörwerk 0.1.4