From 4ddd860c012d42998b81fe2eba5b1ba54f21ce97 Mon Sep 17 00:00:00 2001
From: Jiahao XU <Jiahao_XU@outlook.com>
Date: Sun, 25 Jun 2023 01:23:15 +1000
Subject: [PATCH] ci: Verify before publishing (#1167)

Run `cargo-publish` without `--no-verify` to verify the publish is valid
and does not depend on unpublished crates in job tag of workflow
`release.yml`, which could be caused by incorrect merge order.

Also enabled `check-semver` to `cargo-bins/release-pr@v2` and install
`cargo-semver-checks` using `taiki-e/install-action@v2` in
job make-release-pr of workflow `release-pr.yml`, since
`release-pr` would try to use `cargo-binstall` for installing
`cargo-semver-checks` used in `check-semver`, but we did not explicitly
require `taiki-e/install-actions@v2` to install `cargo-binstall`, so
`release-pr` could fallback to `cargo-install` which is just too slow.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
---
 .github/workflows/release-pr.yml | 3 ++-
 .github/workflows/release.yml    | 2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/.github/workflows/release-pr.yml b/.github/workflows/release-pr.yml
index 5d949d64..c1adea79 100644
--- a/.github/workflows/release-pr.yml
+++ b/.github/workflows/release-pr.yml
@@ -41,7 +41,7 @@ jobs:
       - name: Install cargo-release
         uses: taiki-e/install-action@v2
         with:
-          tool: cargo-release
+          tool: cargo-release,cargo-semver-checks
 
       - uses: cargo-bins/release-pr@v2
         with:
@@ -51,3 +51,4 @@ jobs:
           pr-label: release
           pr-release-notes: ${{ inputs.crate == 'bin' }}
           pr-template-file: .github/scripts/release-pr-template.ejs
+          check-semver: true
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 6ff5a160..06552072 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -51,7 +51,7 @@ jobs:
         tag_prefix: v
     - name: Publish to crates.io
       run: |
-        cargo publish --no-verify -p '${{ needs.info.outputs.crate }}'
+        cargo publish -p '${{ needs.info.outputs.crate }}'
       env:
         CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}