diff --git a/.github/workflows/deploy-site.yml b/.github/workflows/deploy-site.yml
index 528b9b03dd..ae35e3e9f0 100644
--- a/.github/workflows/deploy-site.yml
+++ b/.github/workflows/deploy-site.yml
@@ -80,39 +80,47 @@ jobs:
echo "Compiling Java source from tag ${{ inputs.monorepo_tag }}"
mvn clean compile test -DskipTests=false -Dcheckstyle.skip=true -B
- # 5. Build the Maven Site using THIS repo's pom.xml + src/site/
+ # 5. Update hardcoded version strings in site content
+ # Cookbook files and other markdown pages embed JBang //DEPS lines with
+ # hardcoded artifact versions for direct browsing on GitHub. Update them
+ # to the version being released. (${project.version} references are
+ # handled by Maven resource filtering during mvn site.)
+ - name: Update version strings in site content
+ run: |
+ VERSION="${{ inputs.version }}"
+ echo "Updating copilot-sdk-java version references to ${VERSION}"
+ find src/site/markdown -name "*.md" -type f -exec \
+ sed -i "s|copilot-sdk-java:[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\(-[a-z][a-z0-9-]*\.[0-9][0-9]*\)*|copilot-sdk-java:${VERSION}|g" {} \;
+
+ # 6. Build the Maven Site using THIS repo's pom.xml + src/site/
- name: Build documentation site
run: |
- echo "Building site for version ${{ env.DEPLOY_VERSION }}"
+ echo "Building site for version ${{ inputs.version }}"
mvn site -Dsite.version=${{ inputs.version }} -B
- # 6. Checkout gh-pages branch from this (standalone) repo
- - name: Checkout gh-pages branch
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- with:
- ref: gh-pages
- path: site
- continue-on-error: true
-
- - name: Initialize site if needed
+ # 7. Prepare gh-pages deployment directory
+ - name: Prepare gh-pages directory
run: |
- if [ ! -d "site/.git" ]; then
- rm -rf site
+ # Try to clone existing gh-pages branch (shallow)
+ git clone --depth 1 --branch gh-pages \
+ "https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git" \
+ site 2>/dev/null || {
+ echo "No gh-pages branch exists yet, creating fresh"
mkdir -p site
cd site
git init
git checkout -b gh-pages
- git remote add origin "https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git"
- fi
+ }
- # 7. Copy generated site to version directory
+ # 8. Copy generated site to version directory
- name: Deploy version documentation
run: |
- echo "Deploying documentation for version ${DEPLOY_VERSION}"
+ VERSION="${{ inputs.version }}"
+ echo "Deploying documentation for version ${VERSION}"
- rm -rf "site/${DEPLOY_VERSION}"
- mkdir -p "site/${DEPLOY_VERSION}"
- cp -r target/site/* "site/${DEPLOY_VERSION}/"
+ rm -rf "site/${VERSION}"
+ mkdir -p "site/${VERSION}"
+ cp -r target/site/* "site/${VERSION}/"
# Also publish as /latest/ if requested
if [[ "${{ inputs.publish_as_latest }}" == "true" ]]; then
@@ -121,47 +129,58 @@ jobs:
cp -r target/site/* "site/latest/"
fi
- # 8. Copy version index page from templates
+ # 9. Copy version index page from templates
- name: Copy version index page
run: |
cp .github/templates/index.html site/index.html
cp .github/templates/styles.css site/styles.css
- # 9. Update version list based on directories present in gh-pages
+ # 10. Update version list based on directories present in gh-pages
- name: Update version list from deployed directories
run: |
cd site
MONOREPO_URL="https://github.com/github/copilot-sdk"
- STANDALONE_URL="https://github.com/github/copilot-sdk-java"
+ CURRENT_VERSION="${{ inputs.version }}"
- VERSIONS=$(ls -d */ 2>/dev/null | sed 's|/||' | grep -E '^[0-9]+\.[0-9]+' | sort -Vr || true)
+ # Community releases: versions that existed before the monorepo era.
+ # These are all versions that are NOT the current deploy version.
+ # They go into the "Community releases" collapsible section.
+ COMMUNITY_VERSIONS="1.0.9 1.0.8 1.0.7 1.0.6 1.0.5 1.0.4 1.0.3 1.0.2 1.0.1 1.0.0-beta-java.4 1.0.0-beta-java.3 1.0.0-beta-java.2 1.0.0-beta-java.1 1.0.0-beta-10-java.0 1.0.0-beta-8-java.0 0.3.0-java.2"
+ STANDALONE_URL="https://github.com/github/copilot-sdk-java"
- HAS_SNAPSHOT=$([ -d "snapshot" ] && echo "true" || echo "false")
+ # Current version (the one just deployed)
+ CURRENT_HTML='
'
- CURRENT_HTML=""
+ # Older releases: previous monorepo releases (all version dirs that
+ # are NOT the current version and NOT in the community list)
OLDER_HTML=""
- IS_FIRST_VERSION="true"
-
- if [ "$HAS_SNAPSHOT" = "true" ]; then
- CURRENT_HTML+='
'
+ # Community releases
+ COMMUNITY_HTML=""
+ for v in $COMMUNITY_VERSIONS; do
+ if [ -d "$v" ]; then
+ RELEASE_URL="${STANDALONE_URL}/releases/tag/v${v}"
+ COMMUNITY_HTML+='