clone

a self-hosted sync node for lofi apps: jazz sync over iroh, ticket-gated, with no static ip or cloud needed

release/0.5.0
lofi-node / .github / workflows / publish.yml
publish.yml 5.4K
1# Tag a release (e.g. `git tag v0.1.0 && git push origin v0.1.0`) to publish2# @nzip/lofi-node to JSR and attach compiled binaries + native addon artifacts3# to the GitHub release. The tag version must match "version" in deno.json.4name: publish56on:7 push:8 tags: ["v*.*.*"]910permissions:11 contents: write # gh release create + asset upload12 id-token: write # JSR OIDC publish1314jobs:15 publish:16 runs-on: ubuntu-latest17 steps:18 - uses: actions/checkout@v41920 - uses: denoland/setup-deno@v221 with:22 deno-version: v2.x2324 - name: Tag must match deno.json version25 run: |26 tag="${GITHUB_REF_NAME#v}"27 manifest="$(deno eval 'console.log(JSON.parse(Deno.readTextFileSync("deno.json")).version)')"28 if [ "$tag" != "$manifest" ]; then29 echo "::error::tag v$tag does not match deno.json version $manifest"30 exit 131 fi3233 - name: Release artifacts manifest must be fresh34 run: |35 deno task release:artifacts36 git diff --exit-code src/native/artifacts.ts3738 - name: Format, lint, typecheck39 run: deno task check4041 - uses: dtolnay/rust-toolchain@stable4243 - uses: Swatinem/rust-cache@v244 with:45 workspaces: native/iroh-js4647 - name: Build native addon48 run: deno task native4950 - name: Full test suite51 run: deno task test5253 - name: Publish dry run54 run: deno publish --dry-run --allow-dirty5556 - name: Publish to JSR57 run: deno publish5859 # No linux-arm64 binary: jazz-napi ships no linux-arm64-gnu platform60 # package, so that target cannot boot the Jazz server. Restore it when61 # upstream publishes the package.62 - name: Compile release binaries63 run: |64 deno task compile:darwin-arm6465 deno task compile:linux-x646667 - name: Stage release assets68 run: |69 mkdir -p dist/assets70 cp dist/lofi-node-aarch64-apple-darwin dist/assets/71 cp dist/lofi-node-x86_64-unknown-linux-gnu dist/assets/72 # Raw addon artifacts under the names artifacts.ts pins.73 cp native/iroh-js/prebuilt/aarch64-apple-darwin/libnumber0_iroh.dylib \74 dist/assets/libnumber0_iroh-aarch64-apple-darwin.dylib75 cp native/iroh-js/prebuilt/x86_64-unknown-linux-gnu/libnumber0_iroh.so \76 dist/assets/libnumber0_iroh-x86_64-unknown-linux-gnu.so77 cp native/iroh-js/prebuilt/aarch64-unknown-linux-gnu/libnumber0_iroh.so \78 dist/assets/libnumber0_iroh-aarch64-unknown-linux-gnu.so79 (cd dist/assets && sha256sum * > SHA256SUMS)80 cat dist/assets/SHA256SUMS8182 - name: Create GitHub release with assets83 env:84 GH_TOKEN: ${{ github.token }}85 run: |86 gh release create "$GITHUB_REF_NAME" dist/assets/* \87 --title "$GITHUB_REF_NAME" --generate-notes8889 - name: Registry smoke — CLI, library, and dx from a clean dir90 run: |91 version="${GITHUB_REF_NAME#v}"92 smoke="$(mktemp -d)"93 cd "$smoke"94 # --minimum-dependency-age=0: we are smoking the version we JUST95 # published; the supply-chain age gate (24h default) must not apply.96 for i in $(seq 1 20); do97 deno run --minimum-dependency-age=0 -A "jsr:@nzip/lofi-node@$version/cli" >/dev/null 2>&1 && break98 echo "waiting for registry propagation ($i)"; sleep 1599 done100 deno run --minimum-dependency-age=0 -A "jsr:@nzip/lofi-node@$version/cli" | head -3101 deno eval --minimum-dependency-age=0 "import { looksLikeAppTicket } from 'jsr:@nzip/lofi-node@$version'; if (!looksLikeAppTicket('lofisync1.abcdef')) throw new Error('lib smoke failed'); console.log('library import ok')"102 deno x --minimum-dependency-age=0 -A "jsr:@nzip/lofi-node@$version/cli" && echo "deno x subpath form works" || echo "::warning::deno x probe failed (expected while the fresh version is inside the minimum-dependency-age window; deno x does not accept the override yet)"103104 docker:105 needs: publish106 runs-on: ubuntu-latest107 permissions:108 contents: read109 packages: write # GHCR push110 steps:111 - uses: actions/checkout@v4112113 - name: Build image (linux/amd64)114 run: |115 version="${GITHUB_REF_NAME#v}"116 image="ghcr.io/felinestatemachine/lofi-node"117 docker build -t "$image:$version" -t "$image:latest" .118119 - name: Image smoke — init, start, health, mesh up120 run: |121 version="${GITHUB_REF_NAME#v}"122 image="ghcr.io/felinestatemachine/lofi-node"123 docker volume create smoke124 docker run --rm -v smoke:/data "$image:$version" \125 init --dir /data --port 4802 --public-url http://127.0.0.1:4802126 docker run -d --name smoke -p 4802:4802 -v smoke:/data "$image:$version"127 for i in $(seq 1 30); do128 curl -fsS http://127.0.0.1:4802/health >/dev/null 2>&1 && break129 sleep 2130 done131 curl -fsS http://127.0.0.1:4802/health132 docker logs smoke 2>&1 | grep -q "mesh: up"133 docker rm -f smoke134135 - uses: docker/login-action@v3136 with:137 registry: ghcr.io138 username: ${{ github.actor }}139 password: ${{ secrets.GITHUB_TOKEN }}140141 - name: Push image142 run: |143 version="${GITHUB_REF_NAME#v}"144 image="ghcr.io/felinestatemachine/lofi-node"145 docker push "$image:$version"146 docker push "$image:latest"