diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ad6a700..7603a50 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -499,6 +499,46 @@ jobs: ls -la "$staged" + # This runner is Alpine, whose image carries busybox wget and no curl at all — and the step below + # talks to the forge six times, so it died on the first call that was not written to tolerate a + # failure: `curl: command not found`, exit 127, after the whole APK had been built. + # + # It took that long to say so because the two lookups before it end in `|| true` with stderr + # discarded, which is the right shape for "no nightly release exists yet" and indistinguishable + # from "there is no curl on this machine". Installing it here is what makes those two different + # again; the alternative of dropping the `|| true` would fail the step for a first-ever run. + # + # Not busybox wget instead. The asset upload is a multipart -F, which busybox wget cannot send, + # so the channel would publish a release with no APK on it — the exact failure the verification + # at the end of the step below exists to catch. + # + # Conditioned exactly like the step it serves, since nothing else in this job wants curl. The two + # conditions have to stay the same: loosen that one without loosening this one and the publish is + # back to exit 127, several minutes into the job. + - name: ensure curl + if: github.ref == 'refs/heads/main' + run: | + set -eu + SUDO="" + [ "$(id -u)" -eq 0 ] || SUDO="sudo" + + if ! command -v curl >/dev/null 2>&1; then + echo "Installing curl" + if command -v apk >/dev/null 2>&1; then + $SUDO apk add --no-cache curl + elif command -v apt-get >/dev/null 2>&1; then + $SUDO apt-get update -qq + $SUDO apt-get install -y --no-install-recommends curl + elif command -v dnf >/dev/null 2>&1; then + $SUDO dnf install -y curl + else + echo "No apk, apt-get or dnf here, so curl cannot be installed from inside the job." >&2 + echo "Add curl to the runner's image; the nightly cannot be published without it." >&2 + exit 1 + fi + fi + curl --version | head -1 + # ◆ PUBLISHING IT, AND WHAT THAT CAPABILITY IS. # # Whoever can write a release here can put a build on every nightly phone, because the client fetches