mirror of
https://github.com/cargo-bins/cargo-binstall.git
synced 2025-04-20 12:38:43 +00:00
ci: Publish to crates.io in release.yml
after tagging (#1152)
Fixed #1046 so that we don't have to manually run `cargo-publish` after the CI is merged. Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
parent
d8419ea5a2
commit
abecd9ae14
3 changed files with 18 additions and 20 deletions
23
.github/scripts/release-pr-template.ejs
vendored
23
.github/scripts/release-pr-template.ejs
vendored
|
@ -13,26 +13,11 @@ This is a release PR for **<%= crate.name %>** version **<%= version.actual %>**
|
||||||
**Use squash merge.**
|
**Use squash merge.**
|
||||||
|
|
||||||
<% if (crate.name == "cargo-binstall") { %>
|
<% if (crate.name == "cargo-binstall") { %>
|
||||||
Upon merging, this will automatically create the tag `v<%= version.actual %>`, build the CLI, and create a GitHub release with the release notes below.
|
Upon merging, this will automatically create the tag `v<%= version.actual %>`, build the CLI,
|
||||||
You will still need to manually publish the cargo crate:
|
create a GitHub release with the release notes below
|
||||||
|
|
||||||
```
|
|
||||||
$ git switch main
|
|
||||||
$ git pull
|
|
||||||
$ git switch --detach v<%= version.actual %>
|
|
||||||
$ cargo publish -p <%= crate.name %>
|
|
||||||
```
|
|
||||||
<% } else { %>
|
<% } else { %>
|
||||||
Upon merging, this will create the tag `<%= crate.name %>-v<%= version.actual %>`.
|
Upon merging, this will create the tag `<%= crate.name %>-v<%= version.actual %>`
|
||||||
You will still need to manually publish the cargo crate:
|
<% } %>, and CI will publish to crates.io on merge of this PR.
|
||||||
|
|
||||||
```
|
|
||||||
$ git switch main
|
|
||||||
$ git pull
|
|
||||||
$ git switch --detach <%= crate.name %>-v<%= version.actual %>
|
|
||||||
$ cargo publish -p <%= crate.name %>
|
|
||||||
```
|
|
||||||
<% } %>
|
|
||||||
|
|
||||||
**To trigger builds initially, close and then immediately re-open this PR once.**
|
**To trigger builds initially, close and then immediately re-open this PR once.**
|
||||||
|
|
||||||
|
|
1
.github/workflows/ci.yml
vendored
1
.github/workflows/ci.yml
vendored
|
@ -2,6 +2,7 @@ name: CI
|
||||||
|
|
||||||
on:
|
on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
workflow_call:
|
||||||
merge_group:
|
merge_group:
|
||||||
pull_request:
|
pull_request:
|
||||||
types:
|
types:
|
||||||
|
|
14
.github/workflows/release.yml
vendored
14
.github/workflows/release.yml
vendored
|
@ -22,9 +22,16 @@ jobs:
|
||||||
event-data: ${{ toJSON(github.event) }}
|
event-data: ${{ toJSON(github.event) }}
|
||||||
extract-notes-under: '### Release notes'
|
extract-notes-under: '### Release notes'
|
||||||
|
|
||||||
tag:
|
test:
|
||||||
if: needs.info.outputs.is-release == 'true'
|
if: needs.info.outputs.is-release == 'true'
|
||||||
needs: info
|
needs: info
|
||||||
|
uses: ./.github/workflows/ci.yml
|
||||||
|
|
||||||
|
tag:
|
||||||
|
if: needs.info.outputs.is-release == 'true'
|
||||||
|
needs:
|
||||||
|
- info
|
||||||
|
- test
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
|
@ -42,6 +49,11 @@ jobs:
|
||||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
custom_tag: ${{ needs.info.outputs.version }}
|
custom_tag: ${{ needs.info.outputs.version }}
|
||||||
tag_prefix: v
|
tag_prefix: v
|
||||||
|
- name: Publish to crates.io
|
||||||
|
run: |
|
||||||
|
cargo publish --no-verify -p '${{ needs.info.outputs.crate }}'
|
||||||
|
env:
|
||||||
|
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
|
||||||
|
|
||||||
package:
|
package:
|
||||||
if: needs.info.outputs.is-release == 'true' && needs.info.outputs.crate == 'cargo-binstall'
|
if: needs.info.outputs.is-release == 'true' && needs.info.outputs.crate == 'cargo-binstall'
|
||||||
|
|
Loading…
Add table
Reference in a new issue