From 441e4b48526e04983a6f72bc87402adec8afb6c6 Mon Sep 17 00:00:00 2001 From: Dan D Date: Thu, 22 Jan 2026 22:19:26 -0500 Subject: [PATCH 01/10] Refactor publish workflow with separate build jobs and dry run support - Add dry_run input for testing without publishing - Split into separate jobs: codegen, build-typescript, build-rust - Add tsdown build step for ESM-only NPM package - Create release zip artifacts for NPM, JSR, and Rust packages - Upload zip assets to GitHub releases - Use OIDC authentication for JSR publishing (npx jsr publish) - Add explicit permissions for id-token write --- .github/workflows/publish.yml | 294 ++++++++++++++++++++++++++-------- 1 file changed, 230 insertions(+), 64 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index d375521..9f00bbd 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -10,76 +10,66 @@ on: description: "Version to publish (e.g. v1.2.3). Used when manually dispatching." required: false type: string + dry_run: + description: "Dry run mode - generate artifacts without publishing" + required: false + type: boolean + default: false -permissions: write-all +permissions: + contents: write + id-token: write jobs: codegen: runs-on: ubuntu-24.04 + outputs: + version: ${{ steps.version.outputs.VERSION }} + tag: ${{ steps.version.outputs.TAG }} steps: - name: Checkout code uses: actions/checkout@v4 with: - fetch-depth: 0 + fetch-depth: 0 - - name: Show files exist - run: | - set -euxo pipefail - ls -la packages/ts || true - ls -la packages/rust || true - cat packages/ts/deno.json - cat packages/ts/package.json - cat packages/rust/Cargo.toml - - - name: Determine VERSION + - name: Determine version + id: version run: | set -euo pipefail if [ "${{ github.ref_type }}" = "tag" ]; then - VERSION="${{ github.ref_name }}" + TAG="${{ github.ref_name }}" elif [ -n "${{ inputs.version || '' }}" ]; then - VERSION="${{ inputs.version }}" + TAG="${{ inputs.version }}" else echo "No tag ref and no 'version' input. Provide a tag (push a tag) or pass inputs.version." >&2 exit 1 fi - # If you don't want the leading 'v' inside files, strip it: - STRIPPED="${VERSION#v}" - echo "VERSION=$STRIPPED" >> "$GITHUB_ENV" - echo "Resolved VERSION=$STRIPPED" - - - name: Set Package Versions to current tag - run: | - set -euxo pipefail - for f in \ - packages/ts/deno.json \ - packages/ts/package.json \ - packages/rust/Cargo.toml - do - test -f "$f" || { echo "Missing $f" >&2; exit 1; } - # replace __PACKAGE_VERSION__ with env VERSION - sed -i "s/__PACKAGE_VERSION__/${VERSION//\//-}/g" "$f" - done + VERSION="${TAG#v}" + echo "VERSION=$VERSION" >> "$GITHUB_OUTPUT" + echo "TAG=$TAG" >> "$GITHUB_OUTPUT" + echo "Resolved VERSION=$VERSION, TAG=$TAG" - name: Setup Buf uses: bufbuild/buf-setup-action@main with: github_token: ${{ github.token }} - - name: Generate code + - name: Generate protobuf code run: buf generate + - name: Set package versions + run: | + set -euxo pipefail + VERSION="${{ steps.version.outputs.VERSION }}" + for f in packages/ts/deno.json packages/ts/package.json packages/rust/Cargo.toml; do + test -f "$f" || { echo "Missing $f" >&2; exit 1; } + sed -i "s/__PACKAGE_VERSION__/${VERSION}/g" "$f" + done + - name: Copy license & README run: | - cp LICENSE packages/ts - cp LICENSE packages/rust - cp README.md packages/ts - cp README.md packages/rust - - - name: Upload Rust code - uses: actions/upload-artifact@v4 - with: - name: rust_code - path: packages/rust + cp LICENSE README.md packages/ts/ + cp LICENSE README.md packages/rust/ - name: Upload TypeScript code uses: actions/upload-artifact@v4 @@ -87,33 +77,60 @@ jobs: name: ts_code path: packages/ts - - name: Push to schema registry - env: - BUF_TOKEN: ${{ secrets.BUF_TOKEN }} - run: | - buf push --tag ${{ github.ref_name }} + - name: Upload Rust code + uses: actions/upload-artifact@v4 + with: + name: rust_code + path: packages/rust - publish-jsr: + build-typescript: runs-on: ubuntu-24.04 needs: codegen - permissions: - contents: read - id-token: write steps: - name: Download TypeScript code uses: actions/download-artifact@v4 with: name: ts_code - - name: Remove package.json (JSR doesn’t need it) - run: rm -f package.json - - name: Set up Deno - uses: denoland/setup-deno@main - with: - deno-version: rc - - name: Publish to JSR - run: deno publish --unstable-sloppy-imports - publish-cargo: + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: "22" + + - name: Install dependencies + run: npm install + + - name: Build with tsdown + run: npm run build + + - name: Show build output + run: | + echo "=== Build output ===" + ls -la + ls -la dist/ + + - name: Upload built NPM package + uses: actions/upload-artifact@v4 + with: + name: npm_package + path: | + dist/ + package.json + LICENSE + README.md + + - name: Upload JSR package + uses: actions/upload-artifact@v4 + with: + name: jsr_package + path: | + lib/ + mod.ts + deno.json + LICENSE + README.md + + build-rust: runs-on: ubuntu-24.04 needs: codegen steps: @@ -121,12 +138,161 @@ jobs: uses: actions/download-artifact@v4 with: name: rust_code - - name: Set up Rust + + - name: Setup Rust uses: actions-rust-lang/setup-rust-toolchain@v1 - - name: Check Library - run: cargo check + + - name: Build library + run: cargo build --release + + - name: Show build output + run: | + echo "=== Build output ===" + ls -la + ls -la target/release/ || true + + - name: Upload built Rust package + uses: actions/upload-artifact@v4 + with: + name: rust_package + path: | + src/ + Cargo.toml + Cargo.lock + LICENSE + README.md + + create-release-zips: + runs-on: ubuntu-24.04 + needs: [codegen, build-typescript, build-rust] + steps: + - name: Download NPM package + uses: actions/download-artifact@v4 + with: + name: npm_package + path: npm_package + + - name: Download JSR package + uses: actions/download-artifact@v4 + with: + name: jsr_package + path: jsr_package + + - name: Download Rust package + uses: actions/download-artifact@v4 + with: + name: rust_package + path: rust_package + + - name: Create zip archives + run: | + cd npm_package && zip -r ../meshtastic-protobufs-npm.zip . && cd .. + cd jsr_package && zip -r ../meshtastic-protobufs-jsr.zip . && cd .. + cd rust_package && zip -r ../meshtastic-protobufs-rust.zip . && cd .. + + - name: Upload release zips + uses: actions/upload-artifact@v4 + with: + name: release_zips + path: | + meshtastic-protobufs-npm.zip + meshtastic-protobufs-jsr.zip + meshtastic-protobufs-rust.zip + + upload-release-assets: + runs-on: ubuntu-24.04 + needs: [codegen, create-release-zips] + if: ${{ !inputs.dry_run }} + steps: + - name: Download release zips + uses: actions/download-artifact@v4 + with: + name: release_zips + + - name: Upload assets to GitHub release + uses: softprops/action-gh-release@v2 + with: + tag_name: ${{ needs.codegen.outputs.tag }} + files: | + meshtastic-protobufs-npm.zip + meshtastic-protobufs-jsr.zip + meshtastic-protobufs-rust.zip + + push-buf-registry: + runs-on: ubuntu-24.04 + needs: codegen + if: ${{ !inputs.dry_run }} + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Setup Buf + uses: bufbuild/buf-setup-action@main + with: + github_token: ${{ github.token }} + + - name: Push to schema registry + env: + BUF_TOKEN: ${{ secrets.BUF_TOKEN }} + run: buf push --tag ${{ needs.codegen.outputs.tag }} + + publish-npm: + runs-on: ubuntu-24.04 + needs: [codegen, build-typescript] + if: ${{ !inputs.dry_run }} + steps: + - name: Download NPM package + uses: actions/download-artifact@v4 + with: + name: npm_package + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: "22" + registry-url: "https://registry.npmjs.org" + + - name: Publish to NPM + run: npm publish --access public + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + + publish-jsr: + runs-on: ubuntu-24.04 + needs: [codegen, build-typescript] + if: ${{ !inputs.dry_run }} + permissions: + contents: read + id-token: write + steps: + - name: Download JSR package + uses: actions/download-artifact@v4 + with: + name: jsr_package + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: "22" + + - name: Publish to JSR + run: npx jsr publish + + publish-cargo: + runs-on: ubuntu-24.04 + needs: [codegen, build-rust] + if: ${{ !inputs.dry_run }} + steps: + - name: Download Rust package + uses: actions/download-artifact@v4 + with: + name: rust_package + + - name: Setup Rust + uses: actions-rust-lang/setup-rust-toolchain@v1 + - name: Publish to crates.io uses: katyo/publish-crates@v2 with: registry-token: ${{ secrets.CARGO_TOKEN }} - ignore-unpublished-changes: true \ No newline at end of file + ignore-unpublished-changes: true From 84f8569c9e14b27ee81e1af005faf25552d8a505 Mon Sep 17 00:00:00 2001 From: Dan D Date: Thu, 22 Jan 2026 22:21:08 -0500 Subject: [PATCH 02/10] Rename ci.yml to schema-registry.yml for clarity --- .github/workflows/{ci.yml => schema-registry.yml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{ci.yml => schema-registry.yml} (100%) diff --git a/.github/workflows/ci.yml b/.github/workflows/schema-registry.yml similarity index 100% rename from .github/workflows/ci.yml rename to .github/workflows/schema-registry.yml From 649568805f5001240f3df0ac13167616915a7167 Mon Sep 17 00:00:00 2001 From: Dan D Date: Thu, 22 Jan 2026 22:46:18 -0500 Subject: [PATCH 03/10] Remove Rust/Cargo publishing from workflow --- .github/workflows/publish.yml | 76 ++--------------------------------- 1 file changed, 4 insertions(+), 72 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 9f00bbd..70bc637 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,4 +1,4 @@ -name: Publish to Cargo, JSR, & NPM +name: Publish to JSR & NPM on: push: @@ -61,15 +61,13 @@ jobs: run: | set -euxo pipefail VERSION="${{ steps.version.outputs.VERSION }}" - for f in packages/ts/deno.json packages/ts/package.json packages/rust/Cargo.toml; do + for f in packages/ts/deno.json packages/ts/package.json; do test -f "$f" || { echo "Missing $f" >&2; exit 1; } sed -i "s/__PACKAGE_VERSION__/${VERSION}/g" "$f" done - name: Copy license & README - run: | - cp LICENSE README.md packages/ts/ - cp LICENSE README.md packages/rust/ + run: cp LICENSE README.md packages/ts/ - name: Upload TypeScript code uses: actions/upload-artifact@v4 @@ -77,12 +75,6 @@ jobs: name: ts_code path: packages/ts - - name: Upload Rust code - uses: actions/upload-artifact@v4 - with: - name: rust_code - path: packages/rust - build-typescript: runs-on: ubuntu-24.04 needs: codegen @@ -130,41 +122,9 @@ jobs: LICENSE README.md - build-rust: - runs-on: ubuntu-24.04 - needs: codegen - steps: - - name: Download Rust code - uses: actions/download-artifact@v4 - with: - name: rust_code - - - name: Setup Rust - uses: actions-rust-lang/setup-rust-toolchain@v1 - - - name: Build library - run: cargo build --release - - - name: Show build output - run: | - echo "=== Build output ===" - ls -la - ls -la target/release/ || true - - - name: Upload built Rust package - uses: actions/upload-artifact@v4 - with: - name: rust_package - path: | - src/ - Cargo.toml - Cargo.lock - LICENSE - README.md - create-release-zips: runs-on: ubuntu-24.04 - needs: [codegen, build-typescript, build-rust] + needs: [codegen, build-typescript] steps: - name: Download NPM package uses: actions/download-artifact@v4 @@ -178,17 +138,10 @@ jobs: name: jsr_package path: jsr_package - - name: Download Rust package - uses: actions/download-artifact@v4 - with: - name: rust_package - path: rust_package - - name: Create zip archives run: | cd npm_package && zip -r ../meshtastic-protobufs-npm.zip . && cd .. cd jsr_package && zip -r ../meshtastic-protobufs-jsr.zip . && cd .. - cd rust_package && zip -r ../meshtastic-protobufs-rust.zip . && cd .. - name: Upload release zips uses: actions/upload-artifact@v4 @@ -197,7 +150,6 @@ jobs: path: | meshtastic-protobufs-npm.zip meshtastic-protobufs-jsr.zip - meshtastic-protobufs-rust.zip upload-release-assets: runs-on: ubuntu-24.04 @@ -216,7 +168,6 @@ jobs: files: | meshtastic-protobufs-npm.zip meshtastic-protobufs-jsr.zip - meshtastic-protobufs-rust.zip push-buf-registry: runs-on: ubuntu-24.04 @@ -277,22 +228,3 @@ jobs: - name: Publish to JSR run: npx jsr publish - - publish-cargo: - runs-on: ubuntu-24.04 - needs: [codegen, build-rust] - if: ${{ !inputs.dry_run }} - steps: - - name: Download Rust package - uses: actions/download-artifact@v4 - with: - name: rust_package - - - name: Setup Rust - uses: actions-rust-lang/setup-rust-toolchain@v1 - - - name: Publish to crates.io - uses: katyo/publish-crates@v2 - with: - registry-token: ${{ secrets.CARGO_TOKEN }} - ignore-unpublished-changes: true From 41b270cff026414277aaaf49b91ce6c9faabc6f1 Mon Sep 17 00:00:00 2001 From: Dan D Date: Thu, 22 Jan 2026 22:48:10 -0500 Subject: [PATCH 04/10] Remove Rust plugins from buf code generation --- buf.gen.yaml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/buf.gen.yaml b/buf.gen.yaml index 1306002..daec499 100644 --- a/buf.gen.yaml +++ b/buf.gen.yaml @@ -3,8 +3,3 @@ plugins: - remote: buf.build/bufbuild/es:v2.1.0 out: packages/ts/lib opt: target=ts - - remote: buf.build/community/neoeinstein-prost:v0.4.0 - out: packages/rust/src/generated - - remote: buf.build/community/neoeinstein-prost-crate:v0.4.1 - out: packages/rust/src/generated - opt: no_features From cfa561adae6bd0ad1b2cac463918378204ae91de Mon Sep 17 00:00:00 2001 From: Dan D Date: Thu, 22 Jan 2026 23:00:28 -0500 Subject: [PATCH 05/10] Add debug output to diagnose missing lib files --- .github/workflows/publish.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 70bc637..03506af 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -57,6 +57,13 @@ jobs: - name: Generate protobuf code run: buf generate + - name: Show generated files + run: | + echo "=== packages/ts contents ===" + ls -la packages/ts/ + echo "=== packages/ts/lib contents ===" + ls -la packages/ts/lib/ || echo "lib folder not found" + - name: Set package versions run: | set -euxo pipefail @@ -84,6 +91,15 @@ jobs: with: name: ts_code + - name: Show downloaded files + run: | + echo "=== Working directory ===" + pwd + echo "=== Contents ===" + ls -la + echo "=== lib/ contents ===" + ls -la lib/ || echo "lib folder not found" + - name: Setup Node.js uses: actions/setup-node@v4 with: From 5fced3fa927c5fb0336ef5364bc0e0e43a69e241 Mon Sep 17 00:00:00 2001 From: Dan D Date: Thu, 22 Jan 2026 23:04:17 -0500 Subject: [PATCH 06/10] Move generated protobuf files from meshtastic/ to lib/ root --- .github/workflows/publish.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 03506af..2787fc2 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -57,6 +57,9 @@ jobs: - name: Generate protobuf code run: buf generate + - name: Move generated files to lib root + run: mv packages/ts/lib/meshtastic/*_pb.ts packages/ts/lib/ + - name: Show generated files run: | echo "=== packages/ts contents ===" From c84d2440ff32f153445f2326e9ff39f56f2554b9 Mon Sep 17 00:00:00 2001 From: Dan D Date: Fri, 30 Jan 2026 15:14:46 -0500 Subject: [PATCH 07/10] Ignore generated protobuf files in packages/ts/lib/ --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index e43b0f9..265ee7c 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,4 @@ .DS_Store + +# Generated protobuf files +packages/ts/lib/ From 9f65fd00e7ba76510938a4f595d7c41f2ca65c31 Mon Sep 17 00:00:00 2001 From: Dan D Date: Fri, 30 Jan 2026 15:20:32 -0500 Subject: [PATCH 08/10] Fix comment indentation in telemetry.proto --- meshtastic/telemetry.proto | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/meshtastic/telemetry.proto b/meshtastic/telemetry.proto index 4db51b7..21a8497 100644 --- a/meshtastic/telemetry.proto +++ b/meshtastic/telemetry.proto @@ -439,9 +439,9 @@ message LocalStats { */ uint32 heap_free_bytes = 13; - /* - * Number of packets that were dropped because the transmit queue was full. - */ + /* + * Number of packets that were dropped because the transmit queue was full. + */ uint32 num_tx_dropped = 14; /* From 518f8e6fb334804b9619382e3a0dd191cece538d Mon Sep 17 00:00:00 2001 From: Dan Ditomaso Date: Sun, 1 Feb 2026 09:57:29 -0500 Subject: [PATCH 09/10] Update .github/workflows/publish.yml Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- .github/workflows/publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 2787fc2..540e118 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -69,7 +69,7 @@ jobs: - name: Set package versions run: | - set -euxo pipefail + set -euo pipefail VERSION="${{ steps.version.outputs.VERSION }}" for f in packages/ts/deno.json packages/ts/package.json; do test -f "$f" || { echo "Missing $f" >&2; exit 1; } From 491783b16491fc3b3ae698c43173cee6fb010e1d Mon Sep 17 00:00:00 2001 From: Dan Ditomaso Date: Sun, 1 Feb 2026 09:58:03 -0500 Subject: [PATCH 10/10] Update .github/workflows/publish.yml Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- .github/workflows/publish.yml | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 540e118..6c61aed 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -58,8 +58,22 @@ jobs: run: buf generate - name: Move generated files to lib root - run: mv packages/ts/lib/meshtastic/*_pb.ts packages/ts/lib/ + run: | + set -euo pipefail + src_dir="packages/ts/lib/meshtastic" + dest_dir="packages/ts/lib" + if [ ! -d "$src_dir" ]; then + echo "Expected source directory '$src_dir' does not exist. 'buf generate' may have failed or changed its output paths." >&2 + exit 1 + fi + + if ! compgen -G "$src_dir"/*_pb.ts > /dev/null; then + echo "No '*_pb.ts' files found in '$src_dir'. 'buf generate' may have produced no TypeScript files or changed their naming." >&2 + exit 1 + fi + + mv "$src_dir"/*_pb.ts "$dest_dir"/ - name: Show generated files run: | echo "=== packages/ts contents ==="