From abf72a42e7ecc1a93db99dd0e5b6b40b77f1ab0a Mon Sep 17 00:00:00 2001 From: Earl Warren Date: Mon, 1 Jul 2024 12:52:59 +0200 Subject: [PATCH] ci(release): upgrade v*.next.forgejo.org when the release is ready The https://v$major.next.forgejo.org instances are polling for new releases with a cron job every hour. This is not only a waste of resources because there is nothing most of the time, it also imposes a delay of maximum one hour when there is a new release. When the release is published, notify the corresponding instance that an upgrade is ready. In the request will 404 but leave a trace in the logs which can trigger an upgrade script if wakeup-on-logs is configured accordingly. GET https://v$major.next.forgejo.org/.well-known/wakeup-on-logs/forgejo-v$major * v8 - a daemon watching on the web server logs was installed for https://v8.next.forgejo.org and will perform the upgrade. * v7 - nothing will happen for https://v7.next.forgejo.org because it still relies on the hourly cron job. * v1.21 - nothing will happen because https://v1.next.forgejo.org does not exist. See also: * https://forgejo.org/docs/next/developer/infrastructure * https://code.forgejo.org/infrastructure/wakeup-on-logs --- .forgejo/workflows/publish-release.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.forgejo/workflows/publish-release.yml b/.forgejo/workflows/publish-release.yml index b89e8d1d7b..19192615dc 100644 --- a/.forgejo/workflows/publish-release.yml +++ b/.forgejo/workflows/publish-release.yml @@ -59,6 +59,16 @@ jobs: gpg-passphrase: ${{ secrets.GPG_PASSPHRASE }} verbose: ${{ vars.VERBOSE }} + - name: upgrade v*.next.forgejo.org + run: | + export DEBIAN_FRONTEND=noninteractive + apt-get update -qq + apt-get -q install -y -qq curl + version="${{ github.ref_name }}" + version=${version##*v} + major=$(echo $version | sed -E -e 's/^([0-9]+).*/\1/') + # https://forgejo.org/docs/next/developer/infrastructure + curl -o /dev/null -sS https://v$major.next.forgejo.org/.well-known/wakeup-on-logs/forgejo-v$major - name: set up go for the DNS update below if: vars.ROLE == 'forgejo-experimental' && secrets.OVH_APP_KEY != ''