Skip to content

Commit

Permalink
Enable publishing to Cargo & JSR
Browse files Browse the repository at this point in the history
  • Loading branch information
sachaw committed Oct 6, 2024
1 parent 5df44cf commit 5ff4ed0
Show file tree
Hide file tree
Showing 22 changed files with 308 additions and 120 deletions.
27 changes: 0 additions & 27 deletions .github/workflows/ci.yml

This file was deleted.

74 changes: 58 additions & 16 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,30 +1,72 @@
name: Push new version to schema registry

permissions:
contents: read
name: Publish to Cargo & JSR

on:
push:
tags:
- "**"

jobs:
push_to_registry:
runs-on: ubuntu-latest
permissions: write-all

jobs:
codegen:
runs-on: ubuntu-24.04
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set Package Versions to current tag
run: sed -i "s/__PACKAGE_VERSION__/$(echo $GITHUB_REF | cut -d '/' -f 3)/g" packages/ts/deno.json \
&& sed -i "s/__PACKAGE_VERSION__/$(echo $GITHUB_REF | cut -d '/' -f 3)/g" packages/rust/Cargo.toml
- name: Setup Buf
uses: bufbuild/buf-setup-action@v1.30.0
uses: bufbuild/buf-setup-action@main
with:
github_token: ${{ github.token }}
- name: Generate code
run: buf generate dewars
- name: Copy license
run: cp LICENSE packages/ts && cp LICENSE packages/rust
- name: Upload Rust code
uses: actions/upload-artifact@v4
with:
name: rust_code
path: packages/rust
- name: Upload TypeScript code
uses: actions/upload-artifact@v4
with:
name: ts_code
path: packages/ts

- name: Push to schema registry
# uses: bufbuild/buf-push-action@v1
# with:
# buf_token: ${{ secrets.BUF_TOKEN }}
run: |
export BUF_TOKEN=${{ secrets.BUF_TOKEN }}
buf push --tag ${{ github.ref_name }}
publish-jsr:
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: Set up Deno
uses: denoland/setup-deno@main
with:
deno-version: rc
- name: Publish to JSR
run: deno publish --unstable-sloppy-imports

publish-cargo:
runs-on: ubuntu-24.04
needs: codegen
steps:
- name: Download Rust code
uses: actions/download-artifact@v4
with:
name: rust_code
- name: Set up Rust
uses: actions-rust-lang/setup-rust-toolchain@v1
- name: Check Library
run: cargo check
- name: Publish to crates.io
uses: katyo/publish-crates@v2
with:
registry-token: ${{ secrets.CARGO_TOKEN }}
ignore-unpublished-changes: true
28 changes: 0 additions & 28 deletions .github/workflows/pull_request.yml

This file was deleted.

4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
packages/ts/lib/*
packages/rust/src/generated/*
packages/rust/target
!.gitkeep
10 changes: 10 additions & 0 deletions buf.gen.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version: v2
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
32 changes: 18 additions & 14 deletions buf.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
version: v1
name: buf.build/meshtastic/protobufs
deps: []
build:
excludes: []
breaking:
use:
- FILE
lint:
ignore_only:
PACKAGE_DEFINED:
- nanopb.proto
use:
- MINIMAL
version: v2
modules:
- path: meshtastic
name: buf.build/meshtastic/protobufs
excludes:
- meshtastic/device_only/
lint:
use:
- MINIMAL
except:
- PACKAGE_NO_IMPORT_CYCLE
disallow_comment_ignores: true
breaking:
use:
- FILE
except:
- EXTENSION_NO_DELETE
- FIELD_SAME_DEFAULT
10 changes: 5 additions & 5 deletions meshtastic/admin.proto
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ syntax = "proto3";

package meshtastic;

import "meshtastic/channel.proto";
import "meshtastic/config.proto";
import "meshtastic/connection_status.proto";
import "meshtastic/mesh.proto";
import "meshtastic/module_config.proto";
import "channel.proto";
import "config.proto";
import "connection_status.proto";
import "mesh.proto";
import "module_config.proto";

option csharp_namespace = "Meshtastic.Protobufs";
option go_package = "github.com/meshtastic/go/generated";
Expand Down
4 changes: 2 additions & 2 deletions meshtastic/apponly.proto
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ syntax = "proto3";

package meshtastic;

import "meshtastic/channel.proto";
import "meshtastic/config.proto";
import "channel.proto";
import "config.proto";

option csharp_namespace = "Meshtastic.Protobufs";
option go_package = "github.com/meshtastic/go/generated";
Expand Down
4 changes: 2 additions & 2 deletions meshtastic/clientonly.proto
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ syntax = "proto3";

package meshtastic;

import "meshtastic/localonly.proto";
import "meshtastic/mesh.proto";
import "localonly.proto";
import "mesh.proto";

option csharp_namespace = "Meshtastic.Protobufs";
option go_package = "github.com/meshtastic/go/generated";
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ syntax = "proto3";

package meshtastic;

import "meshtastic/channel.proto";
import "meshtastic/localonly.proto";
import "meshtastic/mesh.proto";
import "meshtastic/telemetry.proto";
import "meshtastic/config.proto";
import "channel.proto";
import "localonly.proto";
import "mesh.proto";
import "telemetry.proto";
import "config.proto";
import "nanopb.proto";

option csharp_namespace = "Meshtastic.Protobufs";
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions meshtastic/localonly.proto
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ syntax = "proto3";

package meshtastic;

import "meshtastic/config.proto";
import "meshtastic/module_config.proto";
import "config.proto";
import "module_config.proto";

option csharp_namespace = "Meshtastic.Protobufs";
option go_package = "github.com/meshtastic/go/generated";
Expand Down
34 changes: 17 additions & 17 deletions meshtastic/mesh.proto
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ syntax = "proto3";

package meshtastic;

import "meshtastic/channel.proto";
import "meshtastic/config.proto";
import "meshtastic/module_config.proto";
import "meshtastic/portnums.proto";
import "meshtastic/telemetry.proto";
import "meshtastic/xmodem.proto";
import "channel.proto";
import "config.proto";
import "module_config.proto";
import "portnums.proto";
import "telemetry.proto";
import "xmodem.proto";

option csharp_namespace = "Meshtastic.Protobufs";
option go_package = "github.com/meshtastic/go/generated";
Expand Down Expand Up @@ -338,7 +338,7 @@ enum HardwareModel {
* Heltec HRU-3601: https://heltec.org/project/hru-3601/
*/
HELTEC_HRU_3601 = 23;

/*
* Heltec Wireless Bridge
*/
Expand Down Expand Up @@ -541,7 +541,7 @@ enum HardwareModel {
CDEBYTE_EORA_S3 = 61;

/*
* TWC_MESH_V4
* TWC_MESH_V4
* Adafruit NRF52840 feather express with SX1262, SSD1306 OLED and NEO6M GPS
*/
TWC_MESH_V4 = 62;
Expand All @@ -557,27 +557,27 @@ enum HardwareModel {
* ESP32-D0WDQ6 With SX1276/SKY66122, SSD1306 OLED and No GPS
*/
RADIOMASTER_900_BANDIT_NANO = 64;

/*
* Heltec Capsule Sensor V3 with ESP32-S3 CPU, Portable LoRa device that can replace GNSS modules or sensors
*/
HELTEC_CAPSULE_SENSOR_V3 = 65;

/*
* Heltec Vision Master T190 with ESP32-S3 CPU, and a 1.90 inch TFT display
*/
HELTEC_VISION_MASTER_T190 = 66;

/*
* Heltec Vision Master E213 with ESP32-S3 CPU, and a 2.13 inch E-Ink display
*/
HELTEC_VISION_MASTER_E213 = 67;

/*
* Heltec Vision Master E290 with ESP32-S3 CPU, and a 2.9 inch E-Ink display
*/
HELTEC_VISION_MASTER_E290 = 68;

/*
* Heltec Mesh Node T114 board with nRF52840 CPU, and a 1.14 inch TFT display, Ultimate low-power design,
* specifically adapted for the Meshtatic project
Expand All @@ -593,7 +593,7 @@ enum HardwareModel {
* Seeed studio T1000-E tracker card. NRF52840 w/ LR1110 radio, GPS, button, buzzer, and sensors.
*/
TRACKER_T1000_E = 71;

/*
* RAK3172 STM32WLE5 Module (https://store.rakwireless.com/products/wisduo-lpwan-module-rak3172)
*/
Expand Down Expand Up @@ -625,7 +625,7 @@ enum HardwareModel {
*
*/
RP2040_FEATHER_RFM95 = 76;

/* M5 esp32 based MCU modules with enclosure, TFT and LORA Shields. All Variants (Basic, Core, Fire, Core2, CoreS3, Paper) https://m5stack.com/ */
M5STACK_COREBASIC = 77;
M5STACK_CORE2 = 78;
Expand All @@ -635,7 +635,7 @@ enum HardwareModel {

/* M5 esp32 based MCU modules with enclosure, TFT and LORA Shields. All Variants (Basic, Core, Fire, Core2, CoreS3, Paper) https://m5stack.com/ */
M5STACK_CORES3 = 80;

/* Seeed XIAO S3 DK*/
SEEED_XIAO_S3 = 81;

Expand Down Expand Up @@ -1069,7 +1069,7 @@ message MeshPacket {

/*
* Higher priority for specific message types (portnums) to distinguish between other reliable packets.
*/
*/
HIGH = 100;

/*
Expand Down
4 changes: 2 additions & 2 deletions meshtastic/mqtt.proto
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ syntax = "proto3";

package meshtastic;

import "meshtastic/config.proto";
import "meshtastic/mesh.proto";
import "config.proto";
import "mesh.proto";

option csharp_namespace = "Meshtastic.Protobufs";
option go_package = "github.com/meshtastic/go/generated";
Expand Down
Loading

0 comments on commit 5ff4ed0

Please sign in to comment.