mirror of
https://github.com/meshtastic/protobufs.git
synced 2026-04-20 22:13:55 +00:00
Enable publishing to Cargo & JSR
This commit is contained in:
parent
5df44cf804
commit
5ff4ed0248
22 changed files with 308 additions and 120 deletions
27
.github/workflows/ci.yml
vendored
27
.github/workflows/ci.yml
vendored
|
|
@ -1,27 +0,0 @@
|
|||
name: Push commit to schema registry
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
|
||||
jobs:
|
||||
push_to_registry:
|
||||
name: Push to schema registry
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Buf
|
||||
uses: bufbuild/buf-setup-action@v1.30.0
|
||||
with:
|
||||
github_token: ${{ github.token }}
|
||||
|
||||
- name: Push to schema registry
|
||||
uses: bufbuild/buf-push-action@v1.2.0
|
||||
with:
|
||||
buf_token: ${{ secrets.BUF_TOKEN }}
|
||||
74
.github/workflows/publish.yml
vendored
74
.github/workflows/publish.yml
vendored
|
|
@ -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
.github/workflows/pull_request.yml
vendored
28
.github/workflows/pull_request.yml
vendored
|
|
@ -1,28 +0,0 @@
|
|||
name: pull-request
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
on: pull_request
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Buf
|
||||
uses: bufbuild/buf-setup-action@v1.30.0
|
||||
with:
|
||||
github_token: ${{ github.token }}
|
||||
|
||||
- name: Lint
|
||||
uses: bufbuild/buf-lint-action@v1.1.1
|
||||
|
||||
- name: Push to schema registry
|
||||
uses: bufbuild/buf-push-action@v1.2.0
|
||||
if: ${{ github.event_name != 'pull_request_target' && github.event_name != 'pull_request' }}
|
||||
with:
|
||||
buf_token: ${{ secrets.BUF_TOKEN }}
|
||||
draft: ${{ github.ref_name != 'master'}}
|
||||
Loading…
Add table
Add a link
Reference in a new issue