diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f340e80..5b900cc 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -71,6 +71,16 @@ jobs: binary=proofline if [[ "$TARGET" == *windows* ]]; then binary=proofline.exe; fi test "$(target/"$TARGET"/release/"$binary" --version)" = "proofline $VERSION" + if [[ "$TARGET" == x86_64-unknown-linux-musl && -f install.sh ]]; then + sh -n install.sh + grep -Fxq "PROOFLINE_INSTALLER_VERSION=$VERSION" install.sh + if grep -q '^PROOFLINE_SETUP_MIN_VERSION=' install.sh; then + minimum=$(sed -n 's/^PROOFLINE_SETUP_MIN_VERSION=//p' install.sh) + [[ "$minimum" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] + [[ "$(printf '%s\n%s\n' "$minimum" "$VERSION" | sort -V | tail -1)" == "$VERSION" ]] + "target/$TARGET/release/proofline" agent install claude-code --print > /dev/null + fi + fi python3 scripts/archive.py "$TARGET" - uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 with: @@ -104,6 +114,7 @@ jobs: test "$(find artifacts -name '*.tar.gz' | wc -l)" -eq 5 (cd artifacts && LC_ALL=C sha256sum proofline-*.tar.gz > SHA256SUMS) printf '%s\n' "$VERSION" > artifacts/latest + if [[ -f install.sh ]]; then cp install.sh artifacts/install.sh; fi python3 scripts/github-assets.py "$VERSION" artifacts - uses: actions/attest@1e69f48acb82d1966a394da916b4c1698aa569d6 # v4.2.2 with: diff --git a/scripts/publish-r2.sh b/scripts/publish-r2.sh index 08dffc2..0ed90ac 100755 --- a/scripts/publish-r2.sh +++ b/scripts/publish-r2.sh @@ -94,6 +94,9 @@ for target in $targets; do immutable "$version/$archive" "$dist/$archive" application/gzip done immutable "$version/SHA256SUMS" "$dist/SHA256SUMS" 'text/plain; charset=utf-8' +if [ -f "$dist/install.sh" ]; then + immutable "$version/install.sh" "$dist/install.sh" 'text/plain; charset=utf-8' +fi if [ "$latest" != "$version" ]; then printf '%s\n' "$version" > "$temporary/latest" put latest "$temporary/latest" 'text/plain; charset=utf-8' 'public, max-age=60' "$condition" diff --git a/scripts/test_publish_r2.py b/scripts/test_publish_r2.py index 79d26c3..cb8e046 100644 --- a/scripts/test_publish_r2.py +++ b/scripts/test_publish_r2.py @@ -177,6 +177,21 @@ def test_upload_refusal_keeps_latest_absent(self): self.assertNotEqual(self.run_publish().returncode, 0) self.assertEqual(self.requests, []) + def test_installer_failure_preserves_latest_and_retry_finishes_the_release(self): + installer = b"#!/bin/sh\nexit 0\n" + (self.dist / "install.sh").write_bytes(installer) + key = "/proofline-cli-releases/0.1.0/install.sh" + type(self).reject = key + self.assertNotEqual(self.run_publish().returncode, 0) + self.assertNotIn("/proofline-cli-releases/latest", self.objects) + self.requests.clear() + type(self).reject = None + result = self.run_publish() + self.assertEqual(result.returncode, 0, result.stderr) + self.assertEqual([(path, body) for path, _, body in self.requests], [ + (key, installer), ("/proofline-cli-releases/latest", b"0.1.0\n"), + ]) + def test_checksum_mismatch_writes_nothing(self): (self.dist / f"proofline-{TARGETS[-1]}.tar.gz").write_bytes(b"damaged") self.assertNotEqual(self.run_publish().returncode, 0)