name: Publish code0-flow crate
on:
push:
tags:
- '*'
permissions:
contents: read
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: full
jobs:
publish:
runs-on: ubuntu-latest
environment: packages
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v7
- name: Setup rust
run: |
rustup update --no-self-update stable
rustup component add rustfmt clippy
- name: Install protoc
run: |
sudo apt-get update
sudo apt-get install -y protobuf-compiler
protoc --version
- name: Check formatting
run: cargo fmt --all -- --check
- name: Check crate
run: cargo check --locked --all-targets --features all
- name: Run clippy
run: cargo clippy --locked --all-targets --features all -- -D warnings
- name: Run tests
run: cargo test --locked --features all
- name: Set version
run: sed -i "s/version = \"0.0.0\"/version = \"${{ github.ref_name }}\"/" Cargo.toml
- name: Cargo Login
run: cargo login ${{secrets.CARGO_REGISTRY_TOKEN}}
- name: Publish crate
run: cargo publish --allow-dirty