-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
implement automatic publishing of crate when a tagged commit is pushed.
- Loading branch information
Showing
1 changed file
with
56 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
on: | ||
push: | ||
tags: | ||
- '*' | ||
|
||
jobs: | ||
test: | ||
name: Build and Test Project | ||
runs-on: ubuntu-latest | ||
|
||
env: | ||
CARGO_TERM_COLORS: always | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Install Rust | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
profile: minimal | ||
toolchain: stable | ||
components: rustfmt, clippy | ||
|
||
- name: Setup Cargo Cache | ||
uses: actions/cache@v3 | ||
continue-on-error: false | ||
with: | ||
path: | | ||
~/.cargo/bin/ | ||
~/.cargo/registry/index/ | ||
~/.cargo/registry/cache/ | ||
~/.cargo/git/db | ||
target/ | ||
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | ||
restore-keys: ${{ runner.os }}-cargo- | ||
|
||
- name: Setup Protobuf Compiler | ||
uses: arduino/setup-protoc@v2 | ||
|
||
- name: Run Unit Tests | ||
run: cargo test | ||
|
||
publish: | ||
name: Publish crate to crates.io | ||
needs: test | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: stable | ||
override: true | ||
- uses: katyo/publish-crates@v2 | ||
with: | ||
registry-token: ${{ secrets.CARGO_REGISTRY_TOKEN }} |