Update .gitea/workflows/appimage.yml
This commit is contained in:
1 parent
ecd2536a5c
commit
23e01025d9
1 file changed
+25
-25
@@ -24,12 +24,30 @@ jobs:
|
|||||||
libxpresent wayland wayland-protocols libxkbcommon alsa-lib libpulse \
|
libxpresent wayland wayland-protocols libxkbcommon alsa-lib libpulse \
|
||||||
pipewire dconf gdk-pixbuf2
|
pipewire dconf gdk-pixbuf2
|
||||||
|
|
||||||
- name: Find the newest desktop release
|
- name: Sync the mirror and find the newest desktop release
|
||||||
run: |
|
run: |
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
tag=$(curl -fsSL "https://api.github.com/repos/${{ env.UPSTREAM }}/tags?per_page=100" \
|
mirror="${{ gitea.server_url }}/${{ env.MIRROR }}.git"
|
||||||
| jq -r '[.[].name | select(startswith("desktop-v"))][0]')
|
latest() {
|
||||||
if [ -z "$tag" ]; then echo "no desktop tag found" >&2; exit 1; fi
|
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 "TAG=$tag" >> "$GITHUB_ENV"
|
||||||
echo "VERSION=${tag#desktop-v}" >> "$GITHUB_ENV"
|
echo "VERSION=${tag#desktop-v}" >> "$GITHUB_ENV"
|
||||||
|
|
||||||
@@ -42,26 +60,6 @@ jobs:
|
|||||||
echo "already built"; echo "SKIP=1" >> "$GITHUB_ENV"
|
echo "already built"; echo "SKIP=1" >> "$GITHUB_ENV"
|
||||||
fi
|
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 }}@<host>/... 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
|
- name: Install the script and build the web app
|
||||||
if: env.SKIP != '1'
|
if: env.SKIP != '1'
|
||||||
working-directory: src
|
working-directory: src
|
||||||
@@ -77,7 +75,9 @@ jobs:
|
|||||||
- name: Build the AppImage
|
- name: Build the AppImage
|
||||||
if: env.SKIP != '1'
|
if: env.SKIP != '1'
|
||||||
working-directory: src
|
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
|
- name: Publish the AppImage as a Gitea release
|
||||||
if: env.SKIP != '1'
|
if: env.SKIP != '1'
|
||||||
|
|||||||
Reference in new issue
Block a user