From e428d4c5ef85c723fb1b9aa75943fa1ba1901cb1 Mon Sep 17 00:00:00 2001 From: Matthias Date: Fri, 4 Dec 2020 11:25:31 +0100 Subject: [PATCH 1/3] Publish releases on crates.io --- .github/workflows/rust.yml | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index b9352ae25e..618f2b1c10 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,16 @@ jobs: with: command: clippy args: -- -D warnings + + publish: + if: startsWith(github.ref, 'refs/tags/') + needs: + - test + - lint + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + - name: Publish on crates.io + run: | + cargo login ${{ secrets.CARGO_TOKEN }} + cargo publish From 932f124b79aa965dd15aa4fb2d6d57e6a8f1cac9 Mon Sep 17 00:00:00 2001 From: Matthias Date: Fri, 4 Dec 2020 11:33:55 +0100 Subject: [PATCH 2/3] Update rust.yml --- .github/workflows/rust.yml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 618f2b1c10..ca67848b4f 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -47,7 +47,9 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v1 - - name: Publish on crates.io - run: | - cargo login ${{ secrets.CARGO_TOKEN }} - cargo publish + - name: cargo publish + uses: actions-rs/cargo@v1 + env: + CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} + with: + command: publish From b036fe1fcb96e1a90427452f1c1b62add99782fa Mon Sep 17 00:00:00 2001 From: Matthias Date: Fri, 4 Dec 2020 11:39:51 +0100 Subject: [PATCH 3/3] Add publish-check and fetch --- .github/workflows/rust.yml | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index ca67848b4f..da98eca819 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -39,14 +39,38 @@ jobs: 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 + - 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: