Über-Karte in der Administration, docker-publish entfernt #13
1 changed files with 45 additions and 7 deletions
52
.github/workflows/release.yml
vendored
52
.github/workflows/release.yml
vendored
|
|
@ -65,21 +65,45 @@ jobs:
|
|||
- name: Inhalt kurz prüfen
|
||||
run: |
|
||||
set -eu
|
||||
# Die Dateiliste einmal erzeugen und danach nur noch darin suchen.
|
||||
# Frueher lief hier "unzip -l | grep -q" je Datei: grep beendet sich
|
||||
# beim ersten Treffer, unzip stirbt an SIGPIPE, und mit pipefail galt
|
||||
# die Pruefung als fehlgeschlagen - aber nur fuer Dateien, die frueh
|
||||
# in der Liste stehen.
|
||||
unzip -Z1 "dist/${{ steps.meta.outputs.name }}.zip" > /tmp/zip-inhalt.txt
|
||||
|
||||
# Ein paar Dateien muessen enthalten sein, sonst ist das Paket kaputt.
|
||||
for required in \
|
||||
unifi-voucher-tool/index.php \
|
||||
unifi-voucher-tool/install.php \
|
||||
unifi-voucher-tool/database.sql \
|
||||
unifi-voucher-tool/LICENSE \
|
||||
unifi-voucher-tool/THIRD-PARTY-NOTICES.md \
|
||||
unifi-voucher-tool/assets/global.css \
|
||||
unifi-voucher-tool/assets/vendor/inter/inter.css \
|
||||
unifi-voucher-tool/assets/vendor/inter/LICENSE.txt \
|
||||
unifi-voucher-tool/includes/Ui.php
|
||||
do
|
||||
if ! unzip -l "dist/${{ steps.meta.outputs.name }}.zip" | grep -q "$required"; then
|
||||
if ! grep -Fxq "$required" /tmp/zip-inhalt.txt; then
|
||||
echo "Fehlt im Paket: $required" >&2
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
echo "Paket vollständig."
|
||||
|
||||
# Und umgekehrt: Entwicklungsdateien haben im Paket nichts verloren.
|
||||
for forbidden in \
|
||||
unifi-voucher-tool/tests/ \
|
||||
unifi-voucher-tool/tools/ \
|
||||
unifi-voucher-tool/docs/ \
|
||||
unifi-voucher-tool/.github/
|
||||
do
|
||||
if grep -Fq "$forbidden" /tmp/zip-inhalt.txt; then
|
||||
echo "Gehoert nicht ins Paket: $forbidden" >&2
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
|
||||
echo "Paket vollständig ($(wc -l < /tmp/zip-inhalt.txt) Dateien)."
|
||||
|
||||
- name: Als Build-Artefakt sichern
|
||||
uses: actions/upload-artifact@v3
|
||||
|
|
@ -112,9 +136,16 @@ jobs:
|
|||
|
||||
# Rollendes Vorab-Release durch ein frisches ersetzen, damit der
|
||||
# Download-Link stabil bleibt und auf den aktuellen Stand zeigt.
|
||||
# Hinweis: Pipelines hier bewusst ohne "head -1" hinter curl/grep.
|
||||
# Beendet sich das letzte Glied frueher, stirbt das erste an SIGPIPE
|
||||
# und der Schritt bricht ab (pipefail). "grep -m1" auf einer Datei
|
||||
# hat das Problem nicht.
|
||||
if [ "$TAG" = "latest-main" ]; then
|
||||
OLD_ID="$(curl -sf -H "$AUTH" "${API}/releases/tags/${TAG}" \
|
||||
| grep -o '"id":[0-9]*' | head -1 | cut -d: -f2 || true)"
|
||||
curl -sf -H "$AUTH" "${API}/releases/tags/${TAG}" -o /tmp/altes-release.json || true
|
||||
OLD_ID=""
|
||||
if [ -s /tmp/altes-release.json ]; then
|
||||
OLD_ID="$(grep -m1 -o '"id":[0-9]*' /tmp/altes-release.json | cut -d: -f2 || true)"
|
||||
fi
|
||||
if [ -n "${OLD_ID:-}" ]; then
|
||||
curl -sf -X DELETE -H "$AUTH" "${API}/releases/${OLD_ID}" || true
|
||||
curl -sf -X DELETE -H "$AUTH" "${API}/tags/${TAG}" || true
|
||||
|
|
@ -133,12 +164,19 @@ jobs:
|
|||
BODY="${BODY}- oder gleich den eingebauten Updater unter Administration, System-Update verwenden.\n\n"
|
||||
BODY="${BODY}Pruefsumme: siehe beigelegte .sha256-Datei."
|
||||
|
||||
RELEASE_ID="$(curl -sf -X POST -H "$AUTH" -H 'Content-Type: application/json' \
|
||||
# ohne -f, damit bei einem Fehler die Antwort der API im Log landet
|
||||
curl -s -X POST -H "$AUTH" -H 'Content-Type: application/json' \
|
||||
-d "{\"tag_name\":\"${TAG}\",\"target_commitish\":\"${GITHUB_SHA}\",\"name\":\"${TITLE}\",\"body\":\"${BODY}\",\"draft\":false,\"prerelease\":${PRERELEASE}}" \
|
||||
"${API}/releases" | grep -o '"id":[0-9]*' | head -1 | cut -d: -f2)"
|
||||
"${API}/releases" -o /tmp/neues-release.json || true
|
||||
|
||||
RELEASE_ID=""
|
||||
if [ -s /tmp/neues-release.json ]; then
|
||||
RELEASE_ID="$(grep -m1 -o '"id":[0-9]*' /tmp/neues-release.json | cut -d: -f2 || true)"
|
||||
fi
|
||||
|
||||
if [ -z "${RELEASE_ID:-}" ]; then
|
||||
echo "Release konnte nicht angelegt werden." >&2
|
||||
echo "Release konnte nicht angelegt werden:" >&2
|
||||
cat /tmp/neues-release.json >&2 || true
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue