From 3401999ccc6961614260426f37560e17141e47b5 Mon Sep 17 00:00:00 2001 From: Matthias Date: Fri, 4 Dec 2020 13:09:50 +0100 Subject: [PATCH] Publish releases on crates.io (#65) --- .github/workflows/rust.yml | 42 +++++++++++++++++++++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index b9352ae25e..da98eca819 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -19,7 +19,8 @@ jobs: uses: actions-rs/cargo@v1 with: command: test - lints: + + lint: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 @@ -37,3 +38,42 @@ jobs: with: command: clippy args: -- -D warnings + + publish-check: + name: Publish Check + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + - uses: actions-rs/toolchain@v1 + with: + toolchain: stable + override: true + - name: cargo fetch + uses: actions-rs/cargo@v1 + with: + command: fetch + - name: cargo publish check + uses: actions-rs/cargo@v1 + with: + command: publish + args: --dry-run + + publish: + if: startsWith(github.ref, 'refs/tags/') + needs: + - test + - lint + - publish-check + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + - name: cargo fetch + uses: actions-rs/cargo@v1 + with: + command: fetch + - name: cargo publish + uses: actions-rs/cargo@v1 + env: + CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} + with: + command: publish