-
Notifications
You must be signed in to change notification settings - Fork 0
Clarify SSH auth is only for crate registry index, overall cleanup #73
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
Merged
Merged
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
50d393e
refactor!: Restructure rust-prepare action
emgrav fc0933a
refactor!: Adapt workflows to new action
emgrav ac44f8c
refactor!: Clarify inputs as OCI registry
emgrav 270905e
refactor!: Rename crate publish inputs to be consistent
emgrav 19928d2
refactor!: Rename inputs to snake_case
emgrav e62d179
docs: Add v3 to v4 migration guide
emgrav f411991
fix: Use correct input name
emgrav 4b0608c
refactor!: Remove famedly prefix from crate registry vars
emgrav b3014be
chore: Uppercase all GHA secret and variable refs
emgrav 1763ebf
docs: Document GHA vars and secrets
emgrav 5577e83
refactor: Use var as default in publish workflow
emgrav f96a40e
docs: Use variables
emgrav d2a2c21
docs: Fix markdown tables
emgrav 0f2954e
docs: Fix incorrect names
emgrav e438bc9
refactor: Omit revision from local action references
emgrav a90e95e
chore: Use ghcr for rust-container
emgrav a39e8ea
docs: Document case changes to rust workflow inputs
emgrav 10583e4
fix: Handle missing additional packages gracefully
emgrav 7075ccb
docs: Clarify usage of registry auth token
emgrav 5e41690
refactor: Be explicit about word splitting
emgrav 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
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,70 @@ | ||
| #!/usr/bin/env bash | ||
| set -euo pipefail | ||
|
|
||
| echo "Preparing Rust build environment" | ||
|
|
||
| # Ensure repo path is safe | ||
| git config --global --add safe.directory "$(pwd)" | ||
|
|
||
| # Determine sudo availability (works inside and outside containers) | ||
| if [[ "$(id -u)" -eq 0 ]]; then | ||
| SUDO="" | ||
| else | ||
| SUDO="sudo" | ||
| fi | ||
|
|
||
| if [[ -n "${ADDITIONAL_PACKAGES:-}" ]]; then | ||
| echo "Installing additional packages: ${ADDITIONAL_PACKAGES}" | ||
| # We want to be explicit about word splitting here. | ||
| # https://github.com/koalaman/shellcheck/wiki/Sc2046 | ||
| read -ra packages <<< "${ADDITIONAL_PACKAGES}" | ||
| $SUDO apt-get install -yqq --no-install-recommends "${packages[@]}" | ||
| else | ||
| echo "No additional packages specified. Skipping installation." | ||
| fi | ||
|
|
||
|
|
||
| # TODO: Don't set CARGO_HOME to a relative path. It is supposed to be an absolute path, this is potentially problematic. | ||
| # However, it works for now and any change to this needs to be thoroughly tested as github actions is really weird about runner home directories. | ||
| echo "Setting up build environment" | ||
| echo "CARGO_HOME = ${HOME}/${CARGO_HOME}" | ||
| mkdir -p "${HOME}/${CARGO_HOME}" | ||
|
|
||
| # Decide public/private mode based on presence of private key | ||
| if [[ -z "${CRATE_REGISTRY_SSH_PRIVKEY:-}" ]]; then | ||
|
sirewix marked this conversation as resolved.
|
||
| echo "No private registry SSH key provided. Configuring for public builds." | ||
| export CRATE_REGISTRY_NAME="crates-io" | ||
| else | ||
| echo "Private registry credentials detected. Configuring SSH and private registry access." | ||
| USER_NAME="$(whoami)" | ||
| SSH_HOME="$(getent passwd "$USER_NAME" | cut -d: -f6)" | ||
| ssh-agent -a "${SSH_AUTH_SOCK}" > /dev/null | ||
| echo "SSH_AUTH_SOCK=${SSH_AUTH_SOCK}" >> "$GITHUB_ENV" | ||
| ssh-add -vvv - <<< "${CRATE_REGISTRY_SSH_PRIVKEY}"$'\n' | ||
| mkdir -p "$SSH_HOME/.ssh" | ||
| { | ||
| ssh-keyscan -H ssh.shipyard.rs | ||
| } >> "$SSH_HOME/.ssh/known_hosts" | ||
| fi | ||
|
|
||
| cat << EOF >> "${HOME}/${CARGO_HOME}/config.toml" | ||
| [net] | ||
| git-fetch-with-cli = true | ||
| EOF | ||
|
|
||
| if [ "$CRATE_REGISTRY_NAME" != "crates-io" ]; then | ||
| cat << EOF >> "${HOME}/${CARGO_HOME}/config.toml" | ||
| [registries.${CRATE_REGISTRY_NAME}] | ||
| index = "${CRATE_REGISTRY_INDEX_URL}" | ||
| EOF | ||
| fi | ||
|
|
||
| echo "CARGO_HOME=${HOME}/${CARGO_HOME}" >> "$GITHUB_ENV" | ||
|
|
||
| # Persist registry settings for subsequent GitHub Actions steps | ||
| echo "CRATE_REGISTRY_NAME=${CRATE_REGISTRY_NAME}" >> "$GITHUB_ENV" | ||
| if [[ -n "${CRATE_REGISTRY_INDEX_URL:-}" ]]; then | ||
| echo "CRATE_REGISTRY_INDEX_URL=${CRATE_REGISTRY_INDEX_URL}" >> "$GITHUB_ENV" | ||
| fi | ||
|
|
||
| echo "Preparations finished" | ||
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
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
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.