| 1 |
name: Upload Crates.io Package |
| 2 |
|
| 3 |
on: |
| 4 |
push: |
| 5 |
tags: |
| 6 |
- v*.*.* |
| 7 |
|
| 8 |
jobs: |
| 9 |
test: |
| 10 |
name: Test |
| 11 |
strategy: |
| 12 |
matrix: |
| 13 |
os: [ubuntu-latest, macOS-latest, "windows-latest"] |
| 14 |
runs-on: ${{ matrix.os }} |
| 15 |
steps: |
| 16 |
- uses: actions/checkout@v1 |
| 17 |
- uses: actions-rs/toolchain@v1 |
| 18 |
with: |
| 19 |
toolchain: stable |
| 20 |
override: true |
| 21 |
- name: cargo fetch |
| 22 |
uses: actions-rs/cargo@v1 |
| 23 |
with: |
| 24 |
command: fetch |
| 25 |
- name: cargo build |
| 26 |
uses: actions-rs/cargo@v1 |
| 27 |
with: |
| 28 |
command: build |
| 29 |
args: --tests |
| 30 |
- name: cargo test |
| 31 |
uses: actions-rs/cargo@v1 |
| 32 |
with: |
| 33 |
command: test |
| 34 |
|
| 35 |
cargo-deny: |
| 36 |
runs-on: ubuntu-latest |
| 37 |
steps: |
| 38 |
- uses: actions/checkout@v1 |
| 39 |
- uses: EmbarkStudios/cargo-deny-action@v1 |
| 40 |
|
| 41 |
publish_check: |
| 42 |
name: Publish check |
| 43 |
runs-on: ubuntu-latest |
| 44 |
steps: |
| 45 |
- uses: actions/checkout@v1 |
| 46 |
- uses: actions-rs/toolchain@v1 |
| 47 |
with: |
| 48 |
toolchain: stable |
| 49 |
override: true |
| 50 |
- name: cargo fetch |
| 51 |
uses: actions-rs/cargo@v1 |
| 52 |
with: |
| 53 |
command: fetch |
| 54 |
- name: cargo publish |
| 55 |
uses: actions-rs/cargo@v1 |
| 56 |
with: |
| 57 |
command: publish |
| 58 |
args: --dry-run |
| 59 |
- name: docs check |
| 60 |
uses: actions-rs/cargo@v1 |
| 61 |
with: |
| 62 |
command: doc |
| 63 |
args: --no-deps |
| 64 |
|
| 65 |
publish: |
| 66 |
name: Publish |
| 67 |
runs-on: ubuntu-latest |
| 68 |
needs: [test, cargo-deny, publish_check] |
| 69 |
if: startsWith(github.ref, 'refs/tags/') |
| 70 |
steps: |
| 71 |
- uses: actions/checkout@v1 |
| 72 |
- uses: actions-rs/toolchain@v1 |
| 73 |
with: |
| 74 |
toolchain: stable |
| 75 |
override: true |
| 76 |
- name: cargo fetch |
| 77 |
uses: actions-rs/cargo@v1 |
| 78 |
with: |
| 79 |
command: fetch |
| 80 |
- name: cargo publish |
| 81 |
uses: actions-rs/cargo@v1 |
| 82 |
env: |
| 83 |
CARGO_REGISTRY_TOKEN: ${{ secrets.CRATES_IO_TOKEN }} |
| 84 |
with: |
| 85 |
command: publish |
| 86 |
- name: Create Release |
| 87 |
uses: actions/create-release@v1 |
| 88 |
env: |
| 89 |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 90 |
with: |
| 91 |
tag_name: ${{ github.ref }} |
| 92 |
release_name: ${{ github.ref }} |
| 93 |
draft: false |
| 94 |
prerelease: false |