mirror of
https://github.com/cargo-bins/cargo-binstall.git
synced 2025-04-21 04:58:42 +00:00
Fix CI: Dry-run cargo-publish
on crate to be published (#1490)
* Fix CI: Dry-run `cargo-publish` on crate to be published If there's no crate to publish, do not dry-run `cargo-publish`. Only dry-run `cargo-publish` on crate to be published to avoid `cargo-publish` error on `cargo-binstall` when one of its direct dependencies is bumped. Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com> * Fix passing of crate to `release-cli.yml` Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com> * Fix passing of `needs.pr-info.outpus.crate` Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com> * Fix `release-dry-run`: Only run if is release or is not PR event Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com> * Fix passing of crate Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com> * Rm `just-setup` from `release-cli.yml` since it cannot be cached release is trigged by the closing of PR, so the cache is saved under the branch `release/*` which cannot be reused. Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com> * Fix dry-run publish Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com> --------- Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
parent
26b6db2244
commit
4599a70839
2 changed files with 20 additions and 7 deletions
19
.github/workflows/ci.yml
vendored
19
.github/workflows/ci.yml
vendored
|
@ -123,15 +123,30 @@ jobs:
|
|||
- run: just avoid-dev-deps
|
||||
- run: just lint
|
||||
|
||||
pr-info:
|
||||
outputs:
|
||||
is-release: ${{ steps.meta.outputs.is-release }}
|
||||
crate: ${{ steps.meta.outputs.crates-names }}
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- id: meta
|
||||
if: github.event_name == 'pull_request'
|
||||
uses: cargo-bins/release-meta@v1
|
||||
with:
|
||||
event-data: ${{ toJSON(github.event) }}
|
||||
extract-notes-under: '### Release notes'
|
||||
|
||||
release-dry-run:
|
||||
needs: pr-info
|
||||
uses: ./.github/workflows/release-cli.yml
|
||||
if: github.event_name != 'pull_request'
|
||||
if: github.event_name != 'pull_request' || needs.pr-info.outputs.is-release == 'true'
|
||||
secrets: inherit
|
||||
with:
|
||||
info: |
|
||||
{
|
||||
"is-release": false,
|
||||
"crate": "cargo-binstall",
|
||||
"crate": "${{ needs.pr-info.outputs.crate }}",
|
||||
"version": "0.0.0",
|
||||
"notes": ""
|
||||
}
|
||||
|
|
8
.github/workflows/release-cli.yml
vendored
8
.github/workflows/release-cli.yml
vendored
|
@ -83,17 +83,15 @@ jobs:
|
|||
with:
|
||||
name: minisign.pub
|
||||
|
||||
- uses: ./.github/actions/just-setup
|
||||
|
||||
- run: .github/scripts/ephemeral-crate.sh
|
||||
|
||||
- if: fromJSON(inputs.info).is-release != 'true'
|
||||
- if: fromJSON(inputs.info).is-release != 'true' && fromJSON(inputs.info).crate != ''
|
||||
name: DRY-RUN Publish to crates.io
|
||||
env:
|
||||
crate: ${{ fromJSON(inputs.info).crate }}
|
||||
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
|
||||
run: cargo package -p "$crate" --allow-dirty --no-default-features
|
||||
- if: fromJSON(inputs.info).is-release != 'true'
|
||||
run: cargo publish --dry-run -p "$crate" --allow-dirty --no-default-features
|
||||
- if: fromJSON(inputs.info).is-release != 'true' && fromJSON(inputs.info).crate != ''
|
||||
name: Upload crate package as artifact
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
|
|
Loading…
Add table
Reference in a new issue