forked from Xuanwo/xlaude
-
Notifications
You must be signed in to change notification settings - Fork 5
47 lines (37 loc) · 1.27 KB
/
publish.yml
File metadata and controls
47 lines (37 loc) · 1.27 KB
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
name: Publish to crates.io
on:
push:
tags: ['v*'] # Triggers when pushing tags starting with 'v'
permissions:
id-token: write # Required for OIDC token exchange
contents: read
jobs:
publish:
name: Publish to crates.io
runs-on: ubuntu-latest
environment: crates.io # Using pre-configured environment
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
# Run tests one more time before publishing
- name: Run tests
run: cargo test --all-features
# Verify package metadata
- name: Check package
run: cargo package --list
# Authenticate with crates.io using trusted publishing
- uses: rust-lang/crates-io-auth-action@v1
id: auth
# Publish to crates.io
- name: Publish to crates.io
run: cargo publish
env:
CARGO_REGISTRY_TOKEN: ${{ steps.auth.outputs.token }}
# Setup instructions for trusted publishing:
# 1. Go to https://crates.io/me
# 2. Navigate to your crate's settings
# 3. Add GitHub Actions as a trusted publisher:
# - Repository: xuanwo/xlaude
# - Workflow: publish.yml
# - Environment: crates.io