-
-
Notifications
You must be signed in to change notification settings - Fork 0
44 lines (34 loc) · 971 Bytes
/
rust.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
41
42
43
44
name: Rust
on:
pull_request:
push:
env:
CARGO_TERM_COLOR: always
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: shallow clone
uses: actions/checkout@v4
- name: deep clone
uses: actions/checkout@v4
if: startsWith(github.ref, 'refs/tags/v')
with:
fetch-depth: 0
- name: Build
run: cargo build --verbose
- name: Run tests
run: cargo test --verbose
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
if: startsWith(github.ref, 'refs/tags/v')
with:
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Publish crate
if: startsWith(github.ref, 'refs/tags/v')
run: sed -i "s_0.1.0-PLACEHOLDER_${GITHUB_REF/refs\/tags\/v/}_" Cargo.toml && cargo publish --token ${CRATES_TOKEN} --allow-dirty
env:
CRATES_TOKEN: ${{ secrets.CRATES_TOKEN }}