diff options
Diffstat (limited to '.forgejo')
| -rw-r--r-- | .forgejo/workflows/build-iso.yml | 69 |
1 files changed, 63 insertions, 6 deletions
diff --git a/.forgejo/workflows/build-iso.yml b/.forgejo/workflows/build-iso.yml index 6284e78..80723a2 100644 --- a/.forgejo/workflows/build-iso.yml +++ b/.forgejo/workflows/build-iso.yml @@ -23,12 +23,11 @@ jobs: mkdir -p "${GITHUB_WORKSPACE}/.tmp" df -h - - name: Fix raveos-core-repo pacman repo (overwrite clean, first in order) + - name: Fix raveos-core-repo pacman repo (overwrite clean) run: | set -euo pipefail sudo sed -i '/^\[raveos-core-repo\]/,/^$/d' /etc/pacman.conf sudo sed -i '/^\[core\]/i\[raveos-core-repo]\nSigLevel = Required DatabaseOptional\nServer = https://page.rp1.hu/x86_64/\n' /etc/pacman.conf - echo "=== repo sorrend ellenorzes:" grep -n '^\[raveos-core-repo\]\|^\[core\]' /etc/pacman.conf - name: Verify archiso @@ -186,11 +185,9 @@ jobs: echo "${{ secrets.VPS_RELEASE_KEY }}" > ~/.ssh/vps_release_key chmod 600 ~/.ssh/vps_release_key - # Új ISO feltöltése scp -i ~/.ssh/vps_release_key -P ${{ secrets.VPS_PORT }} -o StrictHostKeyChecking=no \ "$ISO_FILE" "${{ secrets.VPS_USER }}@${{ secrets.VPS_HOST }}:${{ secrets.VPS_RELEASES_PATH }}/${ISO_NAME}" - # 3-nál régebbi ISO-k törlése a VPS-ről ssh -i ~/.ssh/vps_release_key -p ${{ secrets.VPS_PORT }} -o StrictHostKeyChecking=no \ ${{ secrets.VPS_USER }}@${{ secrets.VPS_HOST }} "ls -t ${{ secrets.VPS_RELEASES_PATH }}/*.iso 2>/dev/null | tail -n +4 | xargs -r rm -f" @@ -228,7 +225,6 @@ jobs: [[ "$RELEASE_ID" =~ ^[0-9]+$ ]] || { echo "HIBA: Ervenytelen RELEASE_ID: $RELEASE_ID"; exit 1; } echo "Release ID: $RELEASE_ID" - # External link hozzáadása attachment helyett curl -f -s --retry 3 \ -X POST "https://git.rp1.hu/api/v1/repos/RaveOS/RaveOS-Releases/releases/${RELEASE_ID}/assets?external_url=https://release.rp1.hu/${ISO_NAME}" \ -H "Authorization: token ${{ secrets.RELEASE_TOKEN }}" \ @@ -239,7 +235,6 @@ jobs: echo "TAG=${TAG}" >> "$GITHUB_ENV" echo "ISO_SHA256=${ISO_SHA256}" >> "$GITHUB_ENV" - # Regi release-ek torlese (3-nal tobbet nem tartunk) RELEASES=$(curl -f -s --retry 3 --retry-delay 5 \ "https://git.rp1.hu/api/v1/repos/RaveOS/RaveOS-Releases/releases?limit=50" \ -H "Authorization: token ${{ secrets.RELEASE_TOKEN }}") @@ -296,6 +291,68 @@ jobs: bash scripts/discord-notify.sh "${DISCORD_WEBHOOK}" "${TAG}" "${ISO_NAME}" "${ISO_SHA256}" + - name: Update website release data (rp1-blog) + if: success() + env: + RELEASE_TOKEN: ${{ secrets.RELEASE_TOKEN }} + TAG: ${{ env.TAG }} + ISO_NAME: ${{ env.ISO_NAME }} + ISO_SHA256: ${{ env.ISO_SHA256 }} + run: | + set -euo pipefail + if [ -z "${RELEASE_TOKEN:-}" ] || [ -z "${ISO_NAME:-}" ] || [ -z "${ISO_SHA256:-}" ]; then + echo "FIGYELMEZTETES: hianyzo adatok, weboldal frissites kihagyva" + exit 0 + fi + + ISO_FILE=$(ls output/*.iso 2>/dev/null | head -1 || true) + SIZE_FMT="2.3 GB" + if [ -n "${ISO_FILE:-}" ]; then + SIZE_RAW=$(du -h "$ISO_FILE" | cut -f1) + SIZE_FMT=$(echo "$SIZE_RAW" | sed 's/G$/ GB/; s/M$/ MB/') + fi + export SIZE_FMT + + python3 - <<'PY' + import base64, json, os, urllib.request + from datetime import date + + token = os.environ["RELEASE_TOKEN"] + iso_name = os.environ["ISO_NAME"] + iso_sha = os.environ["ISO_SHA256"] + tag = os.environ.get("TAG", "").lstrip("v") + size_fmt = os.environ.get("SIZE_FMT") or "2.3 GB" + + api = "https://git.rp1.hu/api/v1/repos/RaveOS/rp1-blog/contents/src/_data/releases.json" + hdr = {"Authorization": "token " + token, "Content-Type": "application/json"} + + with urllib.request.urlopen(urllib.request.Request(api, headers=hdr), timeout=30) as r: + data = json.load(r) + + doc = json.loads(base64.b64decode(data["content"]).decode()) + latest = doc.setdefault("latest", {}) + latest["version"] = tag or latest.get("version", "") + latest["codename"] = ("RaveOS v" + tag) if tag else latest.get("codename", "") + latest["releaseDate"] = date.today().isoformat() + latest["isoFilename"] = iso_name + latest["isoSize"] = size_fmt + latest["sha256"] = iso_sha + latest["downloadUrl"] = latest.get("downloadUrl") or "https://links.rp1.hu/raveos-download" + + new_content = json.dumps(doc, ensure_ascii=False, indent=2) + "\n" + body = json.dumps({ + "content": base64.b64encode(new_content.encode()).decode(), + "sha": data["sha"], + "message": "release " + (tag or iso_name), + "branch": "main", + }).encode() + + req = urllib.request.Request(api, data=body, headers=hdr, method="PUT") + with urllib.request.urlopen(req, timeout=30) as r: + result = json.load(r) + print("Weboldal adatok frissitve, commit:", result.get("commit", {}).get("sha", "?")) + PY + - name: Cleanup (SAFE) if: always() run: | |