cargo-binstall/.github/workflows/release.yml
Jiahao XU 4ddd860c01
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>
2023-06-24 15:23:15 +00:00

65 lines
1.8 KiB
YAML

name: On release
on:
pull_request:
types: closed
branches: [main] # target branch of release PRs
jobs:
info:
if: github.event.pull_request.merged
outputs:
is-release: ${{ steps.meta.outputs.is-release }}
crate: ${{ steps.meta.outputs.crates-names }}
version: ${{ steps.meta.outputs.version-actual }}
notes: ${{ steps.meta.outputs.notes }}
runs-on: ubuntu-latest
steps:
- id: meta
uses: cargo-bins/release-meta@v1
with:
event-data: ${{ toJSON(github.event) }}
extract-notes-under: '### Release notes'
test:
if: needs.info.outputs.is-release == 'true'
needs: info
uses: ./.github/workflows/ci.yml
tag:
if: needs.info.outputs.is-release == 'true'
needs:
- info
- test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Push lib release tag
if: needs.info.outputs.crate != 'cargo-binstall'
uses: mathieudutour/github-tag-action@v6.1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
custom_tag: ${{ needs.info.outputs.version }}
tag_prefix: ${{ needs.info.outputs.crate }}-v
- name: Push cli release tag
if: needs.info.outputs.crate == 'cargo-binstall'
uses: mathieudutour/github-tag-action@v6.1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
custom_tag: ${{ needs.info.outputs.version }}
tag_prefix: v
- name: Publish to crates.io
run: |
cargo publish -p '${{ needs.info.outputs.crate }}'
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
package:
if: needs.info.outputs.is-release == 'true' && needs.info.outputs.crate == 'cargo-binstall'
needs:
- info
- tag
uses: ./.github/workflows/release-build.yml
with:
publish: ${{ toJSON(needs.info.outputs) }}