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
13 changes: 13 additions & 0 deletions .github/actions/hugo-build-action/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@ runs:
uses: actions/setup-go@v5
with:
go-version: '>=1.20.1'
cache: false
- name: "Cache Go modules"
uses: actions/cache@v4
with:
path: ~/go/pkg/mod
key: go-mod-${{ hashFiles('docs/go.sum') }}
restore-keys: go-mod-
- name: "Setup Node"
uses: actions/setup-node@v4
with:
Expand All @@ -28,6 +35,12 @@ runs:
working-directory: ./docs
run: |
npm ci
- name: "Cache Hugo resources"
uses: actions/cache@v4
with:
path: docs/resources/_gen
key: hugo-resources-${{ hashFiles('docs/go.sum', 'docs/config/**') }}
restore-keys: hugo-resources-
- name: "Build documentation"
working-directory: ./docs
env:
Expand Down
13 changes: 13 additions & 0 deletions .github/actions/hugo-build-versioned-action/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,13 @@ runs:
- uses: actions/setup-go@v5
with:
go-version: '>=1.20.1'
cache: false
- name: "Cache Go modules"
uses: actions/cache@v4
with:
path: ~/go/pkg/mod
key: go-mod-${{ hashFiles('docs/go.sum') }}
restore-keys: go-mod-
- name: "Setup Node"
uses: actions/setup-node@v4
with:
Expand All @@ -59,6 +66,12 @@ runs:
wget https://raw.githubusercontent.com/gooddata/gooddata-python-sdk/master/scripts/generate.sh
chmod +x ./generate.sh
./generate.sh ${{ inputs.fetch-from }} master
- name: "Cache Hugo resources"
uses: actions/cache@v4
with:
path: docs/resources/_gen
key: hugo-resources-${{ hashFiles('docs/go.sum', 'docs/config/**') }}
restore-keys: hugo-resources-
- name: "Build documentation"
working-directory: ./docs
env:
Expand Down
134 changes: 134 additions & 0 deletions .github/workflows/netlify-deploy-v2.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
name: Netlify Deploy V2 (Draft)
on:
workflow_dispatch:

jobs:
# Job 1: Discover which version branches to build
discover-versions:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.versions.outputs.matrix }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Fetch remote refs
run: git fetch origin
- name: Discover versions
id: versions
run: |
MATRIX=$(bash scripts/discover-versions.sh origin 4)
echo "matrix=$MATRIX" >> $GITHUB_OUTPUT
echo "Discovered versions: $MATRIX"

# Job 2: Generate docs for each version (matrix — runs in parallel across versions)
# Each version gets its own runner with that branch's SDK installed.
# Per-version caching means released branches (which rarely change) are instant cache hits.
generate-version:
needs: [discover-versions]
runs-on: ubuntu-latest
strategy:
matrix:
version: ${{ fromJson(needs.discover-versions.outputs.matrix) }}
fail-fast: false
steps:
- name: Get branch commit SHA
id: sha
env:
GH_TOKEN: ${{ github.token }}
run: |
SHA=$(gh api "repos/${{ github.repository }}/git/ref/heads/${{ matrix.version.branch }}" -q '.object.sha')
echo "sha=$SHA" >> $GITHUB_OUTPUT
echo "Branch ${{ matrix.version.branch }} -> section ${{ matrix.version.section }} (SHA: $SHA)"
- name: Cache version docs
id: cache
uses: actions/cache@v4
with:
path: docs/versioned_docs/${{ matrix.version.section }}
key: version-docs-${{ matrix.version.section }}-${{ steps.sha.outputs.sha }}
- name: Checkout
if: steps.cache.outputs.cache-hit != 'true'
uses: actions/checkout@v4
- name: Fetch target branch
if: steps.cache.outputs.cache-hit != 'true'
run: git fetch origin ${{ matrix.version.branch }}
- name: Checkout branch packages
if: steps.cache.outputs.cache-hit != 'true'
run: |
git checkout origin/${{ matrix.version.branch }} -- gooddata-api-client/ packages/gooddata-sdk/ packages/gooddata-pandas/ scripts/script-requirements.txt
- name: Setup Python
if: steps.cache.outputs.cache-hit != 'true'
uses: actions/setup-python@v5
with:
python-version-file: ".python-version"
cache: 'pip'
cache-dependency-path: scripts/script-requirements.txt
- name: Install Dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: |
python -m pip install --upgrade pip
pip install -r scripts/script-requirements.txt
- name: Generate version docs
if: steps.cache.outputs.cache-hit != 'true'
run: bash scripts/generate-single-version.sh "origin/${{ matrix.version.branch }}" "${{ matrix.version.section }}"
- name: Upload version artifact
uses: actions/upload-artifact@v4
with:
name: version-${{ matrix.version.section }}
path: docs/versioned_docs/${{ matrix.version.section }}
retention-days: 1

# Job 3: Assemble all versions, build Hugo site, and deploy to Netlify (draft)
build-and-deploy:
needs: [generate-version]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Setup GO
uses: actions/setup-go@v5
with:
go-version: '>=1.20.1'
cache: false
- name: Cache Go modules
uses: actions/cache@v4
with:
path: ~/go/pkg/mod
key: go-mod-${{ hashFiles('docs/go.sum') }}
restore-keys: go-mod-
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'npm'
cache-dependency-path: docs/package-lock.json
- name: Install Hugo
run: npm install -g hugo-extended@0.117.0
- name: Install Dependencies
working-directory: ./docs
run: npm ci
- name: Download version artifacts
uses: actions/download-artifact@v4
with:
pattern: version-*
path: docs/versioned_docs-raw/
- name: Assemble versioned docs
working-directory: ./docs
run: bash ../scripts/assemble-versions.sh
- name: Cache Hugo resources
uses: actions/cache@v4
with:
path: docs/resources/_gen
key: hugo-resources-${{ hashFiles('docs/go.sum', 'docs/config/**') }}
restore-keys: hugo-resources-
- name: Build documentation
working-directory: ./docs
run: hugo --minify --baseURL https://www.gooddata.com/docs/python-sdk
- name: Publish (draft)
uses: netlify/actions/cli@master
with:
args: deploy -d docs/public
env:
NETLIFY_SITE_ID: 93e23db0-d31a-4a12-801a-b9479ffef486 # Not a secret
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
22 changes: 16 additions & 6 deletions docs/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,21 @@
# syntax=docker/dockerfile:1
FROM python:3.14-slim AS builder

RUN apt-get update && apt-get install -y git make curl

# Install Python deps first (changes rarely) for better layer caching.
# Copy only dependency manifests and package source before installing.
COPY scripts/script-requirements.txt /scripts/script-requirements.txt
COPY docs docs
COPY scripts/docs/ /docs
COPY gooddata-api-client /gooddata-api-client
COPY packages/gooddata-sdk /gooddata-sdk
COPY packages/gooddata-pandas /gooddata-pandas

RUN pip install --no-cache-dir -r /scripts/script-requirements.txt
RUN --mount=type=cache,target=/root/.cache/pip \
pip install -r /scripts/script-requirements.txt

# Copy source (docs content changes most frequently, scripts less so)
COPY docs docs
COPY scripts/docs/ /docs

WORKDIR /docs

Expand All @@ -21,16 +27,20 @@ RUN python json_builder.py && \

FROM node:20.18.0-bookworm-slim

COPY --from=builder /docs /docs

RUN apt-get update && \
apt-get install -y git make golang-go curl && \
npm install -g hugo-extended@0.117.0 && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

COPY --from=builder /docs /docs

WORKDIR /docs
RUN npm install && \

# Use BuildKit cache mounts so npm/Go package downloads survive layer rebuilds
RUN --mount=type=cache,target=/root/.npm \
--mount=type=cache,target=/root/go/pkg/mod \
npm install && \
hugo mod get

# accessible on http://localhost:1313/latest/
Expand Down
55 changes: 55 additions & 0 deletions scripts/assemble-versions.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
#!/bin/bash
# (C) 2026 GoodData Corporation
# Assembles version artifacts into the final versioned_docs structure.
# Run from the docs/ directory after downloading version artifacts.
#
# Expects:
# - versioned_docs-raw/ directory with version-* subdirectories (from artifact download)
# - content/en/ directory with master branch content (from current checkout)
set -e

content_dir=versioned_docs

# Start with clean versioned_docs
rm -rf "$content_dir"
mkdir -p "$content_dir"

# 1. Copy master/current branch content (provides versions page and root structure)
echo "Copying master content from content/en/"
cp -r content/en/. "$content_dir/"

# 2. Move version artifacts from download directory into versioned_docs
if [ -d "versioned_docs-raw" ]; then
for dir in versioned_docs-raw/version-*/; do
[ -d "$dir" ] || continue
section=$(basename "$dir" | sed 's/^version-//')
echo "Installing version artifact: $section"
# Remove any existing content for this section (from master copy)
rm -rf "${content_dir:?}/$section"
mv "$dir" "$content_dir/$section"
done
rm -rf versioned_docs-raw
fi

# 3. Remove master's "latest" directory — it will be replaced by the highest numbered version
echo "Removing master's latest directory"
rm -rf "${content_dir:?}/latest"

# 4. Find the highest numbered version and promote it to "latest"
highest_version=$(ls -1 "./$content_dir/" | grep -E '^[0-9]+$' | sort -V | tail -n 1)

if [ -n "$highest_version" ]; then
echo "Promoting version $highest_version to /latest"
mv -f "./$content_dir/$highest_version" "./$content_dir/latest"

# Update version references in links.json
if [ -f "./$content_dir/latest/links.json" ]; then
sed "s|${highest_version}|latest|g" "./$content_dir/latest/links.json" > temp_links.json
mv temp_links.json "./$content_dir/latest/links.json"
fi
else
echo "WARNING: No numbered version directory found to promote to latest"
fi

echo "Assembly complete. Contents of $content_dir/:"
ls -la "$content_dir/"
48 changes: 48 additions & 0 deletions scripts/discover-versions.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#!/bin/bash
# (C) 2026 GoodData Corporation
# Discovers release versions for parallel doc generation.
# Outputs a JSON array suitable for GitHub Actions matrix strategy.
# Usage: discover-versions.sh [remote_name] [num_versions]
set -e

remote_name=${1:-origin}
num_versions=${2:-4}

git fetch "$remote_name" 2>/dev/null

# Build a map of section -> branch, keeping only the latest minor per section.
# Associative arrays preserve last-write-wins semantics, matching the original
# generate.sh behavior where later branches overwrite earlier ones.
declare -A section_map
declare -a section_order

while IFS= read -r vers; do
section="${vers%.*}"
if [ -z "${section_map[$section]+x}" ]; then
section_order+=("$section")
fi
# Later (higher minor) versions overwrite earlier ones for the same major
section_map["$section"]="rel/$vers"
done < <(git branch -rl "$remote_name/rel/*" | sed 's|.*/rel/||' | grep -E '^[0-9]+\.[0-9]+$' | sort -t. -k1,1n -k2,2n | tail -n"$num_versions")

# Add dev branch if it exists
if git branch -rl "$remote_name/rel/dev" | grep -q "rel/dev"; then
if [ -z "${section_map[dev]+x}" ]; then
section_order+=("dev")
fi
section_map["dev"]="rel/dev"
fi

# Output as JSON array
echo -n "["
first=true
for section in "${section_order[@]}"; do
branch="${section_map[$section]}"
if [ "$first" = true ]; then
first=false
else
echo -n ","
fi
echo -n "{\"branch\":\"$branch\",\"section\":\"$section\"}"
done
echo "]"
Loading
Loading