Add release CI
This commit is contained in:
parent
909618a78b
commit
c577099d8b
3
.github/workflows/ci.yml
vendored
3
.github/workflows/ci.yml
vendored
|
@ -1,6 +1,3 @@
|
||||||
# "Borrowed" with permission from https://github.com/Jonxslays/piston_rs/blob/master/.github/workflows/ci.yml.
|
|
||||||
# Thanks bud!
|
|
||||||
|
|
||||||
name: CI
|
name: CI
|
||||||
|
|
||||||
on:
|
on:
|
||||||
|
|
46
.github/workflows/release.yml
vendored
Normal file
46
.github/workflows/release.yml
vendored
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
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
|
Loading…
Reference in a new issue