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
1 change: 1 addition & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ jobs:
tools/release/prepare-release.sh
"${{ env.VERSIONED_BUCKET_NAME }}"
"${{ needs.publish.outputs.release_tag }}"
"${{ github.ref_name == github.event.repository.default_branch }}"

# Generate versions.json based on the existing versions in S3 and the new release
- name: Generate versions.json
Expand Down
7 changes: 3 additions & 4 deletions tools/release/generate-versions.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
const fs = require('fs');
import { readFileSync, writeFileSync } from 'node:fs';

const [, , deployLatestArg, majorVersionArg, latestFallbackArg] = process.argv;
const deployLatest = deployLatestArg === 'true';

const rawVersions = fs
.readFileSync('s3-versions.txt', 'utf8')
const rawVersions = readFileSync('s3-versions.txt', 'utf8')
.split(/\r?\n/)
.map(line => line.trim())
.filter(Boolean);
Expand All @@ -24,4 +23,4 @@ if (deployLatest) {
payload.unshift({ version: '', title: `${numericTitle}.x` });
}

fs.writeFileSync('versions.json', JSON.stringify(payload, null, 2));
writeFileSync('versions.json', JSON.stringify(payload, null, 2));
3 changes: 2 additions & 1 deletion tools/release/prepare-release.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

VERSIONED_BUCKET_NAME="$1"
DEPLOY_RELEASE="$2"
IS_DEFAULT_BRANCH="$3"
VERSION="${DEPLOY_RELEASE#v}"
MAJOR_VERSION="v${VERSION%%.*}"

Expand All @@ -16,7 +17,7 @@ fi

DEPLOY_LATEST="false"

if [[ "${{ github.ref_name }}" == "${{ github.event.repository.default_branch }}" ]]; then
if [[ "$IS_DEFAULT_BRANCH" == "true" ]]; then
Comment thread
spike-rabbit marked this conversation as resolved.
DEPLOY_LATEST="true"
if [[ -n "$LATEST_VERSION" && "$LATEST_VERSION" != "$MAJOR_VERSION" ]]; then
aws s3 sync --quiet --no-progress --delete \
Expand Down
5 changes: 0 additions & 5 deletions tools/release/publish-docs.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,4 @@ else
aws s3 sync --quiet --no-progress --delete "pages/" "s3://${VERSIONED_BUCKET_NAME}/$MAJOR_VERSION/"
fi

# Upload versions.json with short cache-control for quick updates
if [[ ! -f "deploy-site/versions.json" ]]; then
echo "Error: deploy-site/versions.json file does not exist"
exit 1
fi
aws s3 cp versions.json s3://${VERSIONED_BUCKET_NAME}/versions.json
Loading