From 23e01025d9f5efa7f429b3bafd06506d21c74daf Mon Sep 17 00:00:00 2001 From: pascalyazid Date: Wed, 21 Oct 2026 22:40:21 +0200 Subject: [PATCH] Update .gitea/workflows/appimage.yml --- .gitea/workflows/appimage.yml | 50 +++++++++++++++++------------------ 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/.gitea/workflows/appimage.yml b/.gitea/workflows/appimage.yml index 45687f0..ede4a7d 100644 --- a/.gitea/workflows/appimage.yml +++ b/.gitea/workflows/appimage.yml @@ -24,12 +24,30 @@ jobs: libxpresent wayland wayland-protocols libxkbcommon alsa-lib libpulse \ pipewire dconf gdk-pixbuf2 - - name: Find the newest desktop release + - name: Sync the mirror and find the newest desktop release run: | set -euo pipefail - tag=$(curl -fsSL "https://api.github.com/repos/${{ env.UPSTREAM }}/tags?per_page=100" \ - | jq -r '[.[].name | select(startswith("desktop-v"))][0]') - if [ -z "$tag" ]; then echo "no desktop tag found" >&2; exit 1; fi + mirror="${{ gitea.server_url }}/${{ env.MIRROR }}.git" + latest() { + git ls-remote --tags "$mirror" 'refs/tags/desktop-v*' \ + | sed 's|.*refs/tags/||; s/\^{}$//' \ + | sort -uV | tail -n 1 + } + prev=$(latest) + # force a sync so a just-published tag isn't missed + curl -fsSL -X POST -H "Authorization: token ${{ secrets.PUBLISH_TOKEN }}" \ + "${{ gitea.server_url }}/api/v1/repos/${{ env.MIRROR }}/mirror-sync" + # wait briefly for the sync to land; if nothing new arrives, the + # current latest is still correct (the skip-check will bail) + tag=$prev + for i in $(seq 1 12); do + tag=$(latest) + if [ "$tag" != "$prev" ]; then break; fi + sleep 10 + done + if [ -z "$tag" ] || [ "$tag" = "null" ]; then + echo "no desktop-v* tags on the mirror" >&2; exit 1 + fi echo "TAG=$tag" >> "$GITHUB_ENV" echo "VERSION=${tag#desktop-v}" >> "$GITHUB_ENV" @@ -42,26 +60,6 @@ jobs: echo "already built"; echo "SKIP=1" >> "$GITHUB_ENV" fi - - name: Catch the mirror up and wait for the tag - if: env.SKIP != '1' - run: | - set -euo pipefail - curl -fsSL -X POST -H "Authorization: token ${{ secrets.PUBLISH_TOKEN }}" \ - "${{ gitea.server_url }}/api/v1/repos/${{ env.MIRROR }}/mirror-sync" - for i in $(seq 1 60); do - if git ls-remote "${{ gitea.server_url }}/${{ env.MIRROR }}.git" \ - "refs/tags/${{ env.TAG }}" | grep -q .; then exit 0; fi - sleep 10 - done - echo "the mirror never received ${{ env.TAG }}" >&2; exit 1 - # private instance? use https://oauth2:${{ secrets.PUBLISH_TOKEN }}@/... above - - - name: Check out the mirror at the tag - if: env.SKIP != '1' - run: | - git clone --depth 1 --branch "${{ env.TAG }}" \ - "${{ gitea.server_url }}/${{ env.MIRROR }}.git" src - - name: Install the script and build the web app if: env.SKIP != '1' working-directory: src @@ -77,7 +75,9 @@ jobs: - name: Build the AppImage if: env.SKIP != '1' working-directory: src - run: sh packages/desktop/scripts/make-appimage.sh + run: | + perl -0pi -e 's/^version = "[^"]*"/version = "$ENV{VERSION}"/m' packages/desktop/Cargo.toml + sh packages/desktop/scripts/make-appimage.sh - name: Publish the AppImage as a Gitea release if: env.SKIP != '1'