Add release CI

This commit is contained in:
Ethan Henderson 2022-07-30 16:42:07 +01:00
parent 909618a78b
commit c577099d8b
2 changed files with 46 additions and 3 deletions

View file

@ -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
View 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