v0.2.0 #2
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release | |
on: | |
release: | |
types: [published] | |
jobs: | |
check-version: | |
name: Check Version | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Check version | |
run: | | |
[[ $(grep -m 1 -oP 'version = "(.*)"' Cargo.toml | sed -rn 's/.*"(.*)"/v\1/p') == ${{ github.event.release.tag_name }} ]] | |
publish: | |
name: Publish release | |
runs-on: ubuntu-latest | |
needs: check-version | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Install rust stable | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
- name: Login to crates.io | |
env: | |
TOKEN: ${{ secrets.CRATES_IO_TOKEN }} | |
run: cargo login $TOKEN | |
- name: Publish dry-run | |
run: cargo publish --dry-run | |
- name: Publish | |
run: cargo publish |