Update Cargo.toml #31
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Rust | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Run tests | |
run: cargo test --verbose | |
set-local-version: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set Rust toolchain | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
override: true | |
- name: Get Version from Cargo.toml | |
id: get_version | |
run: | | |
VERSION=$(awk -F '"' '/^version =/ {print $2}' Cargo.toml) | |
echo "Version of the Rust library is $VERSION" | |
echo "::set-output name=LIB_LOCAL_VERSION::$VERSION" | |
- name: Print Version | |
run: echo "The version of the Rust library is ${{ steps.get_version.outputs.LIB_LOCAL_VERSION }}" | |
cargo-push: | |
needs: test | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set Rust toolchain | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
override: true | |
- name: Publish crates | |
uses: katyo/publish-crates@v2 | |
with: | |
registry-token: ${{ secrets.CARGO_TOKEN }} | |
ignore-unpublished-changes: true | |