mirror of
https://github.com/rust-vmm/rust-vmm-ci.git
synced 2026-08-05 03:08:31 +00:00
add sample github action for crates.io publishing
Add a github action sample workflow file for auto-publishing crates on creation of 'v*' tags. The sample workflow assumes a non-workspace setup, so that cargo publish can be run from the repository root (= crate root). For multi-crate repositories, repository_setup.sh will generate derivatives of this file. There is a useless `cd .` in the `run` step which only exists so that sed can easily replace it with the path for crates in a workspace when auto-generating workflows. Signed-off-by: Patrick Roy <roypat@amazon.co.uk>
This commit is contained in:
21
publish.yml
Normal file
21
publish.yml
Normal file
@@ -0,0 +1,21 @@
|
||||
name: Publish to crates.io
|
||||
|
||||
on:
|
||||
push:
|
||||
tags: ['v*'] # Triggers when pushing version tags
|
||||
|
||||
jobs:
|
||||
publish:
|
||||
runs-on: ubuntu-latest
|
||||
# environment: release # Optional: for enhanced security
|
||||
permissions:
|
||||
id-token: write # Required for OIDC token exchange
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: rust-lang/crates-io-auth-action@v1
|
||||
id: auth
|
||||
- run: |
|
||||
cd .
|
||||
cargo publish
|
||||
env:
|
||||
CARGO_REGISTRY_TOKEN: ${{ steps.auth.outputs.token }}
|
||||
Reference in New Issue
Block a user