Commit 94f389e
committed
feat: Add automated crate publishing workflow
A new GitHub Actions workflow named `publish-crate.yml` has been added
to automate the process of publishing the Rust crate to `crates.io`.
This workflow is triggered either when a new release is published on
GitHub or can be manually invoked via `workflow_dispatch`.
The workflow includes a crucial validation step that checks if the
GitHub release tag (e.g., `v1.2.3`) precisely matches the crate's
version (e.g., `1.2.3`) found in `Cargo.toml`, prefixed with 'v'. This
ensures version consistency between the Git tag and the published crate.
It uses `cargo publish --locked` to guarantee that the published crate
is built with the exact dependency versions specified in `Cargo.lock`,
enhancing build reproducibility and stability. The publishing operation
requires the `CARGO_REGISTRY_TOKEN` secret for authentication with
`crates.io`. This automation streamlines the release process, minimizes
potential human errors, and maintains version integrity.
Influence:
1. Manually trigger the "Publish to crates.io" workflow for testing
purposes.
2. Create a GitHub release (e.g., `v1.0.0`) and publish it to verify
automatic workflow invocation.
3. Test with a release tag that matches the `Cargo.toml` version (e.g.,
`v1.0.0` for `version = "1.0.0"`) to ensure successful publishing.
4. Test with a release tag that does NOT match the `Cargo.toml` version
(e.g., `v1.0.1` for `version = "1.0.0"`) to confirm the validation step
correctly fails the workflow.
5. Verify that the crate is successfully published to `crates.io` after
a successful workflow run.
6. Ensure the `CARGO_REGISTRY_TOKEN` repository secret is correctly
configured with a valid token.
feat: 添加自动化 crate 发布工作流
新增了 GitHub Actions 工作流 `publish-crate.yml`,用于自动化1 parent d63c23a commit 94f389e
1 file changed
Lines changed: 49 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
0 commit comments