-
Notifications
You must be signed in to change notification settings - Fork 0
40 lines (38 loc) · 1020 Bytes
/
cargo-release.yml
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
name: Publish to Crates.io
on:
push:
branches:
- main
tags:
- 'v*'
jobs:
release:
if: startsWith(github.ref, 'refs/tags/v') && github.event_name == 'push'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
- name: Cache Cargo Registry
uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Build and Test
run: |
cargo build --release --verbose
cargo test --verbose
- name: Publish to Crates.io
uses: actions-rs/cargo@v1
with:
command: publish
args: --token ${{ secrets.CARGO_TOKEN }}
env:
CARGO_REGISTERY_TOKEN: ${{ secrets.CARGO_TOKEN }}