Skip to content
Open
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
22 changes: 20 additions & 2 deletions .github/scripts/release-docs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,22 @@

set -euo pipefail

# --dry-run applies and checks the release configuration in this checkout, then
# stops before any GitHub API call. Release candidate validation uses it.
DRY_RUN=false
if [[ "${1:-}" == --dry-run ]]; then
DRY_RUN=true
shift
fi

VERSION_NUMBER="${1:-}" # (e.g. 0.1.0)

if [[ -z "${VERSION_NUMBER}" ]]; then
echo "Error: VERSION_NUMBER is not set."
exit 1
fi

if [[ -z "${GITHUB_REPOSITORY:-}" || -z "${GH_TOKEN:-}" ||
if [[ "${DRY_RUN}" == false ]] && [[ -z "${GITHUB_REPOSITORY:-}" || -z "${GH_TOKEN:-}" ||
-z "${BOT_NAME:-}" || -z "${BOT_EMAIL:-}" ]]; then
echo "Error: GITHUB_REPOSITORY, GH_TOKEN, BOT_NAME, and BOT_EMAIL must be set."
exit 1
Expand All @@ -45,7 +53,11 @@ echo "Version: ${VERSION}"
echo "Channel: ${CHANNEL}"
echo "Channel version: ${CHANNEL_VERSION}"

echo "Creating release branch for ${GITHUB_REPOSITORY}..."
if [[ "${DRY_RUN}" == true ]]; then
echo "Checking the release configuration without publishing (dry run)..."
else
echo "Creating release branch for ${GITHUB_REPOSITORY}..."
fi

if [[ -n "$(git status --porcelain)" ]]; then
echo "Error: Release publication requires a clean docs checkout."
Expand Down Expand Up @@ -108,6 +120,12 @@ if git diff --cached --quiet; then
exit 1
fi

if [[ "${DRY_RUN}" == true ]]; then
git --no-pager diff --cached
echo "Dry run: the release configuration for ${VERSION} applies cleanly. No GitHub API calls were made."
exit 0
fi

BLOB_SHA="$(base64 --wrap=0 config.toml |
jq --raw-input --slurp '{content: ., encoding: "base64"}' |
gh api --method POST "repos/${GITHUB_REPOSITORY}/git/blobs" --input - --jq '.sha')"
Expand Down
102 changes: 102 additions & 0 deletions .github/scripts/release-docs_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,108 @@ EOF
printf 'PASS: %s\n' "${scenario}"
}

# The dry run must apply the release configuration without credentials or any
# GitHub API call, and leave HEAD and the branch untouched.
run_dry_run_case() {
local scenario="$1"
local expected="$2"
local version="${3-0.63.0-rc.1}"
local root="${TEST_ROOT}/${scenario}"
local repo="${root}/checkout"
local before status=0 output

# Copy the release helpers too, so the dry run can run any of them.
mkdir -p "${repo}/.github/scripts"
cp "${SCRIPT_DIR}"/*.sh "${repo}/.github/scripts/"
git -C "${repo}" init -q -b edge
git -C "${repo}" config user.name "Release fixture"
git -C "${repo}" config user.email fixture@example.test
git -C "${repo}" config commit.gpgsign false
git -C "${repo}" config core.autocrlf false
cat > "${repo}/config.toml" << 'EOF'
baseURL = "https://docs.radapp.io/edge/"
version_menu = "edge"
name = "latest"
version = "edge"
github_branch = "edge"
chart_version = "0.62.0"
indexName = "radapp-dev-edge"
title = "Unrelated configuration"
EOF
cat > "${repo}/bicepconfig.json" << 'EOF'
{
"experimentalFeaturesEnabled": {"ociEnabled": true},
"extensions": {
"radius": "br:ghcr.io/radius-project/bicep-types-radius:edge",
"aws": "br:ghcr.io/radius-project/bicep-types-aws:edge"
}
}
EOF
if [[ "${scenario}" == dry-run-drift ]]; then
sed -i '/^chart_version/d' "${repo}/config.toml"
fi
printf 'Existing documentation\n' > "${repo}/README.md"
git -C "${repo}" add .
git -C "${repo}" commit -qm fixture
before="$(git -C "${repo}" rev-parse HEAD)"
if [[ "${scenario}" == dry-run-dirty ]]; then
printf 'Uncommitted user change\n' >> "${repo}/README.md"
fi
: > "${root}/requests"
output="$(
cd "${repo}"
env -u GH_TOKEN -u GITHUB_REPOSITORY -u BOT_NAME -u BOT_EMAIL \
PATH="${TEST_ROOT}/bin:${PATH}" REQUEST_LOG="${root}/requests" SCENARIO="${scenario}" \
bash "${SCRIPT_DIR}/release-docs.sh" --dry-run ${version:+"${version}"} 2>&1
)" || status=$?
if [[ "${expected}" == success ]]; then
[[ "${status}" == 0 ]] || {
echo "${output}" >&2
return 1
}
grep -Fq 'No GitHub API calls were made' <<< "${output}"
for line in 'baseURL = "https://docs.radapp.io/latest/"' 'version_menu = "latest (0.63)"' \
'name = "latest (0.63)"' 'version = "v0.63"' 'github_branch = "v0.63"' \
"chart_version = \"${version}\"" 'indexName = "radapp-dev"' \
'title = "Unrelated configuration"'; do
grep -Fxq "${line}" "${repo}/config.toml"
done
git -C "${repo}" diff --cached --name-only | grep -Fxq config.toml
# Everything the dry run changed is staged for the site build to use.
git -C "${repo}" diff --quiet
else
[[ "${status}" != 0 ]] || {
echo "${scenario} unexpectedly succeeded" >&2
return 1
}
if grep -Fq 'Dry run:' <<< "${output}"; then
echo "${scenario} reported a successful dry run" >&2
return 1
fi
case "${scenario}" in
dry-run-dirty) grep -Fq 'requires a clean docs checkout' <<< "${output}" ;;
dry-run-drift) grep -Fq "expected line for 'chart_version'" <<< "${output}" ;;
dry-run-missing-version) grep -Fq 'VERSION_NUMBER is not set' <<< "${output}" ;;
esac
fi
[[ ! -s "${root}/requests" ]] || {
echo "${scenario} called the GitHub API:" >&2
cat "${root}/requests" >&2
return 1
}
[[ "$(git -C "${repo}" rev-parse HEAD)" == "${before}" ]]
[[ "$(git -C "${repo}" branch --show-current)" == edge ]]
printf 'PASS: %s\n' "${scenario}"
}

run_dry_run_case dry-run-rc success
run_dry_run_case dry-run-final success 0.63.0
run_dry_run_case dry-run-dirty failure
run_dry_run_case dry-run-drift failure
run_dry_run_case dry-run-missing-version failure ""

echo "Docs release dry-run tests passed (5 cases)."

run_case create success
run_case existing success
run_case formatted success
Expand Down
50 changes: 37 additions & 13 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ on:
required: true
default: ""
type: string
commit:
description: Full SHA of the edge docs snapshot that Validate release docs checked for this release
required: true
default: ""
type: string

permissions: {}

Expand All @@ -19,8 +24,37 @@ jobs:
runs-on: ubuntu-24.04
timeout-minutes: 5
permissions:
contents: read # required by actions/create-github-app-token
contents: read # check out and verify the edge history
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: edge
fetch-depth: 0
persist-credentials: false

- name: Ensure inputs.version is valid semver
run: |
python .github/scripts/validate_semver.py "${INPUT_VERSION}"
env:
INPUT_VERSION: ${{ inputs.version }}

# Publish the validated snapshot, never the current edge tip. Verify it
# before running any of its code or requesting a write token.
- name: Check out the validated docs snapshot
run: |
if [[ ! "${INPUT_COMMIT}" =~ ^[0-9a-f]{40}$ ]]; then
echo "::error::inputs.commit must be a full 40-character lowercase commit SHA."
exit 1
fi
if ! git merge-base --is-ancestor "${INPUT_COMMIT}" origin/edge; then
echo "::error::Commit ${INPUT_COMMIT} is not reachable from origin/edge."
exit 1
fi
git checkout --quiet --detach "${INPUT_COMMIT}"
echo "Releasing docs snapshot $(git rev-parse HEAD)."
env:
INPUT_COMMIT: ${{ inputs.commit }}

# Generate a short-lived installation token scoped to this repository.
# Requires RADIUS_RELEASE_BOT installed on radius-project/docs with:
# Contents: Read & Write
Expand All @@ -42,18 +76,8 @@ jobs:
with:
bot-slug-name: ${{ steps.app-token.outputs.app-slug }}

- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
token: ${{ steps.app-token.outputs.token }}
ref: edge
persist-credentials: false

- name: Ensure inputs.version is valid semver
run: |
python .github/scripts/validate_semver.py "${INPUT_VERSION}"
env:
INPUT_VERSION: ${{ inputs.version }}

# The release commit's only parent is the snapshot, and it changes only
# release configuration.
- name: Release docs
run: |
.github/scripts/release-docs.sh "${INPUT_VERSION}"
Expand Down
96 changes: 96 additions & 0 deletions .github/workflows/validate-release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
# yaml-language-server: $schema=https://www.schemastore.org/github-workflow.json
---
name: Validate release docs

# The core Radius release coordinator dispatches this workflow on edge for each
# release candidate and records the run's head_sha as the docs snapshot that the
# final release publishes. It never writes to the repository, deploys Pages, or
# updates search indices.
on:
workflow_dispatch:
inputs:
version:
description: Radius release candidate version supplied by the core release coordinator (e.g. 0.63.0-rc.1)
required: true
default: ""
type: string

permissions: {}

defaults:
run:
shell: bash

jobs:
validate-release-docs:
name: Validate release docs
if: github.ref == 'refs/heads/edge'
runs-on: ubuntu-24.04
timeout-minutes: 20
permissions:
contents: read
env:
HUGO_ENVIRONMENT: production
steps:
# Validate exactly the dispatched commit, even if edge has moved since.
- name: Check out the docs snapshot
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: ${{ github.sha }}
persist-credentials: false

- name: Ensure inputs.version is valid semver
env:
INPUT_VERSION: ${{ inputs.version }}
run: python3 .github/scripts/validate_semver.py "${INPUT_VERSION}"

- name: Check out the snapshot for the release configuration
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
ref: ${{ github.sha }}
path: release-docs
persist-credentials: false

- name: Apply the release configuration without publishing
working-directory: release-docs
env:
INPUT_VERSION: ${{ inputs.version }}
run: |
if [[ "$(git rev-parse HEAD)" != "${GITHUB_SHA}" ]]; then
echo "::error::Expected snapshot ${GITHUB_SHA}, found $(git rev-parse HEAD)."
exit 1
fi
bash .github/scripts/release-docs.sh --dry-run "${INPUT_VERSION}"

- name: Check out release Swagger sources
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
repository: radius-project/radius
ref: refs/tags/v${{ inputs.version }}
path: radius-release
sparse-checkout: swagger
persist-credentials: false

- uses: actions/setup-go@d8cbb8045d7f43706b9177cceb36c1f91a6644d5 # v7.1.0
with:
go-version-file: go.mod
cache-dependency-path: go.sum

- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version-file: .node-version
cache: npm
cache-dependency-path: package-lock.json

# Build the combined site as Publish will after the final release, with the
# snapshot as both channels. Both use the release Swagger, so the result
# depends only on the snapshot and the release tag. Search stays local.
- name: Build the docs site with the release configuration
env:
HUGO_CACHEDIR: ${{ runner.temp }}/hugo-cache
run: |
cp -R radius-release/swagger static/
cp -R radius-release/swagger release-docs/static/
npm ci
npm ci --prefix release-docs
python3 .github/scripts/build_pages.py http://localhost:8000 . release-docs public
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ The [Publish workflow](.github/workflows/publish.yaml) deploys **one GitHub Page

URLs without a channel open the corresponding stable page: `/` opens `/latest/`, and `/installation/` opens `/latest/installation/`. Unversioned downloads such as `/samples/demo/app.bicep` serve the stable file directly. The Docsy menu shows `edge` or `latest (X.Y)` using the release branch's version. Switching keeps the current page when it exists in both channels.

The [core Radius release process](https://github.com/radius-project/radius/blob/main/.github/scripts/coordinate-release.mjs) dispatches [Release docs](.github/workflows/release.yaml) on `edge` for a final release. That workflow creates the `vMAJOR.MINOR` docs branch without changing the default branch.
For each release candidate, the [core Radius release process](https://github.com/radius-project/radius/blob/main/.github/scripts/coordinate-release.mjs) dispatches [Validate release docs](.github/workflows/validate-release.yaml) on `edge`. That read-only workflow checks the exact `edge` commit it runs on: the release configuration for the version must apply cleanly, and the site must build with it and the Radius Swagger from the matching release tag. It writes nothing to the repository, deploys nothing, and updates no search index. The coordinator records that commit as the docs snapshot.

For the final release, the coordinator dispatches [Release docs](.github/workflows/release.yaml) on `edge` with the version and the last validated snapshot. That workflow rejects a commit that isn't reachable from `edge`. It creates or fast-forwards the `vMAJOR.MINOR` docs branch to the snapshot plus one commit that changes only release configuration, so later `edge` changes are not released. The default branch stays `edge`, and no workflow merges release branches back into `edge`. To fix a supported release, merge the fix into `edge`, then backport it to `vX.Y` in a separate pull request.

Pushes to `edge` rebuild both versions. A push or merged pull request on a release branch triggers the same publisher through **Website**, including on branches cut before this migration. The publisher reads the current tip of the newest stable branch, not the commit that cut the release. A typo fix on that branch therefore updates `/latest/` and the unversioned URLs without a new tag or a merge into `edge`. A fix on an older branch does not change which branch serves `/latest/`.

Expand Down
14 changes: 11 additions & 3 deletions content/contributing/contributing-docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -585,16 +585,24 @@ This section covers routine Radius docs maintainer and approver responsibilities

### Branch guidance

Target `edge`, the default branch, for documentation changes. During a final release, the [core Radius release coordinator](https://github.com/radius-project/radius/blob/main/.github/scripts/coordinate-release.mjs) dispatches `release.yaml` on `edge` with the release version. The resulting `vMAJOR.MINOR` branch is the source for stable docs. To correct a published release, backport the relevant fix rather than merging the release branch back into `edge`.
Target `edge`, the default branch, for documentation changes. Release branches are never merged back into `edge`, either manually or by a workflow.

For each release candidate, the [core Radius release coordinator](https://github.com/radius-project/radius/blob/main/.github/scripts/coordinate-release.mjs) dispatches [Validate release docs](https://github.com/radius-project/docs/actions/workflows/validate-release.yaml) on `edge` with the release candidate version. The run validates the exact `edge` commit it starts from. It applies that version's release configuration locally, then builds the site with that configuration and the Radius Swagger files from the matching `v<version>` tag. The run is read-only: it creates no commits or branches, deploys nothing, and updates no search index. The coordinator records the validated commit as the docs snapshot for the release.

For the final release, the coordinator dispatches `release.yaml` on `edge` with the release version and the snapshot validated for the last release candidate. The resulting `vMAJOR.MINOR` branch contains that snapshot plus one release configuration commit, and it is the source for stable docs. Changes merged into `edge` after the snapshot are not part of the release.

To fix a supported release, merge the fix into `edge` first, then open a separate pull request that backports it to `vX.Y`.

### Release commit signing

The [Release docs workflow](https://github.com/radius-project/docs/actions/workflows/release.yaml) runs from `edge`. Like samples publication, it creates the release configuration commit through the GitHub API with the release App token and without overriding the commit's author, committer, or signature. The script retains the checked-out source as its parent, verifies the generated tree, includes the App's DCO sign-off, and requires GitHub to report the commit as verified before creating or fast-forwarding `vX.Y`. The default branch stays `edge`. Publishing a new stable channel updates `latest/` on GitHub Pages; it does not replace `edge/`. No separate private commit-signing key is required.
The [Release docs workflow](https://github.com/radius-project/docs/actions/workflows/release.yaml) runs from `edge`. It requires a full commit SHA that is reachable from `edge` and checks out that commit rather than the current `edge` tip. Like samples publication, it creates the release configuration commit through the GitHub API with the release App token and without overriding the commit's author, committer, or signature. The script makes the snapshot the commit's only parent, verifies the generated tree, includes the App's DCO sign-off, and requires GitHub to report the commit as verified before creating or fast-forwarding `vX.Y`. The default branch stays `edge`. Publishing a new stable channel updates `latest/` on GitHub Pages; it does not replace `edge/`. No separate private commit-signing key is required.

An unsigned historical commit cannot become verified without changing its commit ID. This workflow fix does not rewrite published branches or make older commits verified; do not force-push a release branch to change a badge. New executions must use the updated workflow on `edge`, rather than rerunning an older workflow revision.

Run `bash .github/scripts/release-docs_test.sh` from the repository root to check configuration changes and publication guards using temporary Git repositories and fake API responses. The website build runs the same check without release credentials. It tests the script's behavior, not live GitHub signing or deployment.

To preview a version's release configuration in a clean checkout, run `bash .github/scripts/release-docs.sh --dry-run 0.63.0-rc.1`. The dry run needs no credentials and makes no GitHub API calls. It stages the updated configuration so you can inspect it or build the site; discard it with `git restore --staged --worktree .`.

### Keep the sample application in sync

The Getting Started tutorial embeds the Radius Demo application (`app.bicep` and `app-redis.bicep`) directly from the [`radius-project/samples`](https://github.com/radius-project/samples) repository so the docs never drift from the real, tested sample. The files are vendored into this repo under `static/samples/demo/`. Hugo publishes them under each version's base URL, for example `https://docs.radapp.io/latest/samples/demo/app.bicep`.
Expand All @@ -616,7 +624,7 @@ git add static/samples/demo
git commit -s -m "Sync sample app from radius-project/samples"
```

Set `GITHUB_TOKEN` first if you hit the GitHub API rate limit. Final release branches inherit the samples vendored on `edge`. If those samples need a release-specific correction, run the script on the release branch and submit the update for review.
Set `GITHUB_TOKEN` first if you hit the GitHub API rate limit. Final release branches inherit the samples vendored in the released `edge` snapshot. If those samples need a release-specific correction, run the script on the release branch and submit the update for review.

### References

Expand Down