47 lines
907 B
YAML
47 lines
907 B
YAML
|
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
|