Skip to content

chore: space

chore: space #14

name: Publish Crates & SDKs
on:
release:
types: [ published ]
push:
branches:
- 'release/v*'
workflow_dispatch:
env:
rust_version: 1.83.0
jobs:
install:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: install essentials
run: |
sudo apt-get update
sudo apt-get install -y pkg-config build-essential libudev-dev
npm install --global yarn
- name: Install Rust
shell: "bash"
run: rustup toolchain install ${{ env.rust_version }} --profile minimal
- name: Cache rust
uses: Swatinem/rust-cache@v2
lint:
needs: install
runs-on: ubuntu-latest
defaults:
run:
working-directory: rust/
steps:
- uses: actions/checkout@v4
- name: Run fmt
run: cargo fmt -- --check
- name: Run clippy
run: cargo clippy -- --deny=warnings
publish:
needs: [install, lint]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: run build
working-directory: rust/
run: |
cargo build
- name: cargo publish
working-directory: rust/
run: |
DRY_RUN_FLAG=""
if [ "${DRY_RUN}" = "true" ]; then
DRY_RUN_FLAG="--dry-run"
fi
if [ "${DRY_RUN}" = "true" ]; then
NO_VERIFY_FLAG="--no-verify"
fi
cargo publish $DRY_RUN_FLAG --manifest-path=ephemeral/Cargo.toml --token $CRATES_TOKEN $NO_VERIFY_FLAG
cargo publish $DRY_RUN_FLAG --manifest-path=delegate/Cargo.toml --token $CRATES_TOKEN $NO_VERIFY_FLAG
cargo publish $DRY_RUN_FLAG --manifest-path=commit-attribute/Cargo.toml --token $CRATES_TOKEN $NO_VERIFY_FLAG
cargo publish $DRY_RUN_FLAG --manifest-path=sdk/Cargo.toml --token $CRATES_TOKEN $NO_VERIFY_FLAG
cargo publish $DRY_RUN_FLAG --manifest-path=resolver/Cargo.toml --token $CRATES_TOKEN $NO_VERIFY_FLAG
env:
CRATES_TOKEN: ${{ secrets.CRATES_TOKEN }}
DRY_RUN: ${{ env.DRY_RUN }}
- name: npm run publish
working-directory: ts/
run: |
npm install --global eslint@^8.33.0
npm install --legacy-peer-deps
npm run build
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc
npm set //registry.npmjs.org/:_authToken ${{ secrets.NPM_TOKEN }}
npm run build && npm run lint:fix
if [ "${DRY_RUN}" = "true" ]; then
echo "Running npm publish in dry-run mode"
npm publish --access public --dry-run
else
npm publish --access public
fi
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}