cargo-binstall/.github/workflows/release.yml
Jiahao XU 540fa79c6b
CI: Fix publish (#1760)
* Fix publish in release-cli.yml

Using latest stable rust

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Fix publish in release.yml

Use latest stable rust

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

* Run release-dry-run in merge queue only

Running it twice on PR pipeline and merge queue pipeline only wastes time and causes rate limit.

For PR that modifies release-dry-run and wants to test it, they can temporarily run release-dry-run on PR pipeline.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>

---------

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
2024-06-14 11:33:20 +00:00

54 lines
1.6 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'
release-lib:
if: needs.info.outputs.is-release == 'true' && needs.info.outputs.crate != 'cargo-binstall'
needs: info
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: rustup toolchain install stable --no-self-update --profile minimal
- name: Push lib release tag
if: needs.info.outputs.crate != 'cargo-binstall'
uses: mathieudutour/github-tag-action@v6.2
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
custom_tag: ${{ needs.info.outputs.version }}
tag_prefix: ${{ needs.info.outputs.crate }}-v
- name: Publish to crates.io
run: |
cargo publish -p '${{ needs.info.outputs.crate }}'
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
release-cli:
if: needs.info.outputs.crate == 'cargo-binstall'
needs: info
uses: ./.github/workflows/release-cli.yml
secrets: inherit
with:
info: ${{ toJSON(needs.info.outputs) }}