diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 640706a..005f468 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -168,14 +168,32 @@ jobs: gh release edit nightly --draft --prerelease --latest=false fi - current_tag=$(gh api "repos/$GITHUB_REPOSITORY/git/ref/tags/nightly" --jq .object.sha 2>/dev/null || true) - if [ -n "$current_tag" ]; then - gh api --silent --method PATCH "repos/$GITHUB_REPOSITORY/git/refs/tags/nightly" \ - -f sha="$SOURCE_SHA" -F force=true - else - gh api --silent --method POST "repos/$GITHUB_REPOSITORY/git/refs" \ - -f ref=refs/tags/nightly -f sha="$SOURCE_SHA" - fi + # gh writes the REST error body to stdout on a missing ref, so use + # its exit status—not captured output—to choose create vs update. + # Retry both paths and re-read the ref to keep retries idempotent. + tag_ready=false + for attempt in 1 2 3 4 5; do + if gh api --silent "repos/$GITHUB_REPOSITORY/git/ref/tags/nightly" >/dev/null 2>&1; then + if gh api --silent --method PATCH "repos/$GITHUB_REPOSITORY/git/refs/tags/nightly" \ + -f sha="$SOURCE_SHA" -F force=true; then + tag_ready=true + break + fi + elif gh api --silent --method POST "repos/$GITHUB_REPOSITORY/git/refs" \ + -f ref=refs/tags/nightly -f sha="$SOURCE_SHA"; then + tag_ready=true + break + fi + + [ "$attempt" -eq 5 ] || { + echo "::warning::Git refs API attempt $attempt failed; retrying" + sleep $((attempt * 2)) + } + done + [ "$tag_ready" = true ] || { + echo "::error::could not point the nightly tag at $SOURCE_SHA" + exit 1 + } if [ "$release_exists" = false ]; then gh release create nightly --verify-tag --draft --prerelease --latest=false \ diff --git a/README.md b/README.md index 82893fa..3b7032c 100644 --- a/README.md +++ b/README.md @@ -87,7 +87,7 @@ To install the current successful build from `develop` instead, pass the installer's `--nightly` option through to `sh`: ```bash -curl -fsSL https://re-invention.nl/soulseek-rs/install.sh | sh -s -- --nightly +curl -fsSL https://raw.githubusercontent.com/michel/soulseek-rs/develop/website/public/install.sh | sh -s -- --nightly ``` Nightly is a mutable prerelease rebuilt every day and whenever the **Nightly** diff --git a/website/public/install.sh b/website/public/install.sh index 15326f0..165d778 100644 --- a/website/public/install.sh +++ b/website/public/install.sh @@ -5,7 +5,7 @@ # curl -fsSL https://re-invention.nl/soulseek-rs/install.sh | sh # # Latest successful build from develop: -# curl -fsSL https://re-invention.nl/soulseek-rs/install.sh | sh -s -- --nightly +# curl -fsSL https://raw.githubusercontent.com/michel/soulseek-rs/develop/website/public/install.sh | sh -s -- --nightly # # Stable installs use Homebrew when it is on PATH (macOS and Linux). Nightly # installs always download the prebuilt binary for this platform. Direct @@ -30,7 +30,7 @@ Install the latest stable soulseek-rs release. Options: -h, --help Show this help. When piping the script, pass the option after `sh -s --`: - curl -fsSL https://re-invention.nl/soulseek-rs/install.sh | sh -s -- --nightly + curl -fsSL https://raw.githubusercontent.com/michel/soulseek-rs/develop/website/public/install.sh | sh -s -- --nightly SOULSEEK_RS_INSTALL_DIR overrides the destination directory. EOF diff --git a/website/src/lib/links.ts b/website/src/lib/links.ts index ff75651..fdb4f37 100644 --- a/website/src/lib/links.ts +++ b/website/src/lib/links.ts @@ -27,4 +27,5 @@ export const SITE_URL = 'https://re-invention.nl/soulseek-rs/' export const INSTALL_CMD = `curl -fsSL ${SITE_URL}install.sh | sh` -export const NIGHTLY_INSTALL_CMD = `${INSTALL_CMD} -s -- --nightly` +export const NIGHTLY_INSTALL_CMD = + 'curl -fsSL https://raw.githubusercontent.com/michel/soulseek-rs/develop/website/public/install.sh | sh -s -- --nightly'