Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -114,13 +114,30 @@ runs:

echo "Running: netdocs ${cmd[*]} (in ${run_dir})"

# Forward AWS credentials so plugins that reach S3 during the build (imported-docs
# pull sources, for one) can authenticate. A web-identity token lives in a file on
# the runner, so that file has to be mounted as well as named.
aws_args=()
for var in AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY AWS_SESSION_TOKEN \
AWS_REGION AWS_DEFAULT_REGION AWS_ROLE_ARN AWS_ROLE_SESSION_NAME; do
if [ -n "${!var:-}" ]; then
aws_args+=(-e "${var}")
fi
done
if [ -n "${AWS_WEB_IDENTITY_TOKEN_FILE:-}" ] && [ -f "${AWS_WEB_IDENTITY_TOKEN_FILE}" ]; then
token_path="$(cd "$(dirname "${AWS_WEB_IDENTITY_TOKEN_FILE}")" && pwd)/$(basename "${AWS_WEB_IDENTITY_TOKEN_FILE}")"
aws_args+=(-v "${token_path}:/tmp/aws-web-identity-token:ro")
aws_args+=(-e "AWS_WEB_IDENTITY_TOKEN_FILE=/tmp/aws-web-identity-token")
fi

# Mount the checked-out workspace and run as the runner user so generated
# files (e.g. ./site) are owned by the runner and readable by later steps.
docker run --rm \
-v "${GITHUB_WORKSPACE}:/github/workspace" \
-w "${run_dir}" \
-u "$(id -u):$(id -g)" \
-e HOME=/tmp \
"${aws_args[@]}" \
"${ref}" "${cmd[@]}"

echo "image=${ref}" >> "${GITHUB_OUTPUT}"
Expand Down
4 changes: 4 additions & 0 deletions docs-site/docs/setup/publishing.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,10 @@ Inputs:
The action runs on Linux, Windows, and macOS runners (x64, plus Apple Silicon). Pin to a
major tag like `@v1` for stability, or a full version tag for reproducible builds.

Any AWS credentials already configured on the runner are forwarded into the build, so a
preceding `aws-actions/configure-aws-credentials` step is enough to authenticate plugins
that read from S3 — [imported docs](../plugins/imported-docs.md) pull sources, for example.

## Built-in deploy targets

Instead of wiring up a workflow, `netdocs` can publish the build itself. Add a `deploy`
Expand Down