Skip to content

Commit baf73ee

Browse files
authored
ci: add publish step to the release workflow (#8)
Bumps the crate version to v0.10.0-rc-2 for testing purposes.
1 parent dbad179 commit baf73ee

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

.github/workflows/release.yml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,23 @@ on:
66
jobs:
77
publish:
88
runs-on: ubuntu-latest
9+
# Source: https://crates.io/docs/trusted-publishing
10+
environment: release # Optional: for enhanced security
11+
permissions:
12+
id-token: write # Required for OIDC token exchange
913
steps:
1014
- uses: actions/checkout@v5
15+
- uses: rust-lang/crates-io-auth-action@v1
16+
id: auth
17+
- run: cargo publish
18+
env:
19+
CARGO_REGISTRY_TOKEN: ${{ steps.auth.outputs.token }}
1120

1221
# Source: https://medium.com/@usman_qb
1322
- name: Create release body
1423
id: create_release_body
1524
run: |
16-
RELEASEVERSION="[${{ github.ref_name }}]"
25+
RELEASEVERSION="[${{ github.ref_name.slice(1) }}]"
1726
echo "Version: $RELEASEVERSION"
1827
RELEASEBODY=$(awk -v ver="$RELEASEVERSION" '/^## / { if (p) { exit }; if ($2 == ver) { p=1; next } } p && NF' CHANGELOG.md)
1928
{
@@ -28,5 +37,5 @@ jobs:
2837
run: |
2938
echo "Creating release for ${{ github.ref_name }}"
3039
echo "${{ steps.create_release_body.outputs.RELEASEBODY }}"
31-
gh release create "${{ github.ref_name }}" --title "release_${{ github.ref_name }}" --notes "${{ steps.create_release_body.outputs.RELEASEBODY }}"
40+
gh release create "${{ github.ref_name }}" --title "${{ github.ref_name }}" --notes "${{ steps.create_release_body.outputs.RELEASEBODY }}"
3241
echo "Release created successfully"

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "rand_core"
3-
version = "0.10.0-rc-1"
3+
version = "0.10.0-rc-2"
44
authors = ["The Rand Project Developers", "The Rust Project Developers"]
55
license = "MIT OR Apache-2.0"
66
readme = "README.md"

0 commit comments

Comments
 (0)