aboutsummaryrefslogtreecommitdiffstats
path: root/.github/workflows/rust.yml
diff options
context:
space:
mode:
Diffstat (limited to '.github/workflows/rust.yml')
-rw-r--r--.github/workflows/rust.yml27
1 files changed, 25 insertions, 2 deletions
diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml
index 7defc50..2f86db0 100644
--- a/.github/workflows/rust.yml
+++ b/.github/workflows/rust.yml
@@ -13,8 +13,8 @@ on:
- ".github/workflows/rust.yml"
jobs:
- rust:
- name: Build and Test
+ lint-build-test:
+ name: Lint, Lint, Build and Test
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
@@ -24,5 +24,28 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
+ - name: Lint
+ run: |
+ cargo fmt --all --check
+ cargo clippy
- name: Test
run: cargo test --verbose
+
+ publish:
+ name: Publish to crates.io
+ needs: lint-build-test
+ # Only run on this on proper semver (vX.Y.Z) tags
+ if: ${{ github.ref_type == 'tag' && startsWith(github.ref_name, 'v') }}
+ runs-on: ubuntu-latest
+ permissions:
+ id-token: write
+ steps:
+ - name: Checkout repository
+ uses: actions/checkout@v4
+ with:
+ fetch-depth: 0
+ - uses: actions-rust-lang/setup-rust-toolchain@v1
+ - name: Publish
+ run: cargo publish
+ env:
+ CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_TOKEN }} \ No newline at end of file