-
Notifications
You must be signed in to change notification settings - Fork 17
ci: add Rust release workflows for aws-db-esdk #2280
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
lucasmcdonald3
wants to merge
6
commits into
main
Choose a base branch
from
lucmcdon/rust-publish-workflow
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+299
−0
Open
Changes from 1 commit
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
a7dbf52
ci: add Rust publish workflow for releases/rust/db_esdk
e6b8be2
ci: align rust-release.yml with RELEASE.md and existing CI style
52d90e3
ci: add rust-start-release workflow and tighten version validation
1ba2bc5
ci: drop RELEASE.md references from Rust release workflows
4571521
ci(rust-start-release): pin to default branch and open PR as CI bot
c4a828c
ci(rust-release): strengthen ordering language to MUST
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,78 @@ | ||
| name: Rust Release (publish to crates.io) | ||
|
|
||
| # Publishes the Rust crate in releases/rust/db_esdk/ to crates.io. | ||
| # | ||
| # Manual-only trigger. The version to publish is taken from | ||
| # releases/rust/db_esdk/Cargo.toml; the workflow_dispatch input is an | ||
| # optional safety check. | ||
| # | ||
| # Authenticates with a long-lived crates.io API token issued under the | ||
| # Crypto Tools CI bot account. The token is stored in a repository secret | ||
| # named CARGO_REGISTRY_TOKEN, gated by the `crates-io-publish` GitHub | ||
| # environment (configure required reviewers on the environment to add | ||
| # human approval at run time). | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| inputs: | ||
| version: | ||
| description: "Optional. If provided, must match Cargo.toml version exactly (e.g. '1.2.5', no leading 'v'). Used as a typo safeguard; if omitted, the version in releases/rust/db_esdk/Cargo.toml is published as-is." | ||
| required: false | ||
| type: string | ||
|
|
||
| permissions: {} | ||
|
|
||
| jobs: | ||
| publish: | ||
| name: Publish aws-db-esdk to crates.io | ||
| runs-on: ubuntu-22.04 | ||
| environment: crates-io-publish | ||
| permissions: | ||
| contents: read | ||
| defaults: | ||
| run: | ||
| working-directory: releases/rust/db_esdk | ||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v6 | ||
|
|
||
| - name: Setup Rust toolchain | ||
| uses: actions-rust-lang/setup-rust-toolchain@v1 | ||
| with: | ||
| cache: false | ||
|
|
||
| - name: Read crate version from Cargo.toml | ||
| id: cargo | ||
| run: | | ||
| set -euo pipefail | ||
| CRATE_VERSION="$(cargo metadata --no-deps --format-version=1 \ | ||
| | python3 -c "import json, sys; print(json.load(sys.stdin)['packages'][0]['version'])")" | ||
| CRATE_NAME="$(cargo metadata --no-deps --format-version=1 \ | ||
| | python3 -c "import json, sys; print(json.load(sys.stdin)['packages'][0]['name'])")" | ||
| echo "version=${CRATE_VERSION}" >> "$GITHUB_OUTPUT" | ||
| echo "name=${CRATE_NAME}" >> "$GITHUB_OUTPUT" | ||
| echo "Will publish ${CRATE_NAME} v${CRATE_VERSION}" | ||
|
|
||
| - name: Verify input version matches Cargo.toml (if provided) | ||
| if: ${{ inputs.version != '' }} | ||
| env: | ||
| INPUT_VERSION: ${{ inputs.version }} | ||
| CARGO_VERSION: ${{ steps.cargo.outputs.version }} | ||
| run: | | ||
| set -euo pipefail | ||
| # Strip an optional leading 'v' from the input for convenience. | ||
| NORMALIZED_INPUT="${INPUT_VERSION#v}" | ||
| if [ "${NORMALIZED_INPUT}" != "${CARGO_VERSION}" ]; then | ||
| echo "::error::Input version '${INPUT_VERSION}' (normalized: '${NORMALIZED_INPUT}') does not match Cargo.toml version '${CARGO_VERSION}'." | ||
| echo "Either fix the input or update Cargo.toml in a separate PR." | ||
| exit 1 | ||
| fi | ||
| echo "Input version matches Cargo.toml: ${CARGO_VERSION}" | ||
|
|
||
| - name: Cargo publish (dry run) | ||
| run: cargo publish --dry-run --locked || cargo publish --dry-run | ||
|
|
||
| - name: Cargo publish | ||
| env: | ||
| CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} | ||
| run: cargo publish --locked || cargo publish | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.