-
Notifications
You must be signed in to change notification settings - Fork 4
46 lines (42 loc) · 1.04 KB
/
publish.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
name: Publish
on:
push:
tags:
- v*
jobs:
version:
name: Version
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Check version
run: |
version=`cargo metadata | jq -r '.packages[] | select(.name == "${{ env.CRATE_NAME }}") | .version'`
version=v"${version}"
[ "${version}" ] && [ "${version}" == "${{ github.ref_name }}" ]
check:
name: Check
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Build
run: cargo build --verbose
- name: Format
run: cargo fmt --all -- --check
- name: Clippy
run: cargo clippy
- name: Run tests
run: cargo test --verbose
publish:
name: Publish
needs: [version, check]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Publish
uses: katyo/publish-crates@v2
with:
registry-token: ${{ secrets.CARGO_REGISTRY_TOKEN }}