-
Notifications
You must be signed in to change notification settings - Fork 4
47 lines (47 loc) · 1.21 KB
/
publish.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
45
46
47
name: publish
on:
push:
tags:
- v*
jobs:
test:
runs-on: ${{matrix.os}}
strategy:
fail-fast: false
matrix:
rust: [nightly, beta, stable]
os: [macos-latest, ubuntu-latest, windows-latest]
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: ${{matrix.rust}}
profile: minimal
- name: Run Tests
run: cargo test
publish:
runs-on: ubuntu-20.04
needs: [test]
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
- uses: olegtarasov/[email protected]
id: tagName
name: Get Tag Name
with:
tagRegex: "v(?<version>.*)"
- name: Set Package Version
env:
GIT_TAG_NAME: ${{ steps.tagName.outputs.version }}
run: sed -i "s/version = \"0.1.0\"/version = \"${GIT_TAG_NAME}\"/" Cargo.toml
- name: Cargo Login
env:
CARGO_TOKEN: ${{ secrets.CARGO_TOKEN }}
run: cargo login $CARGO_TOKEN
- name: Cargo Publish Dry Run
run: cargo publish --dry-run
- name: Cargo Publish
run: cargo publish