Skip to content

Update file(s) from groupdocs-viewer/Groupdocs.Viewer-References [dep… #116

Update file(s) from groupdocs-viewer/Groupdocs.Viewer-References [dep…

Update file(s) from groupdocs-viewer/Groupdocs.Viewer-References [dep… #116

name: Refresh Root Aggregates
# Lightweight: rebuild the bucket-root aggregates from product SOURCE — no Hugo build:
# /search-index.json (the 404 live search source) and /llms-full.txt (the combined, compacted
# whole-reference file). Runs on any content push so both stay current between full Deploy All
# runs.
#
# ⚠️ Push-triggered runs ALWAYS target staging, deliberately. These aggregates are built from
# EVERY product's current source, so refreshing production here would publish index entries for
# products that have not been promoted yet — search results that 404. Letting production's index
# LAG instead means it is merely missing new entries, which is the safe failure direction.
# Production aggregates are refreshed by `deploy_all.yml` (the site-wide promotion unit, which
# publishes the pages and the index together) or by a manual run of this workflow.
on:
workflow_dispatch:
inputs:
environment:
description: 'Target environment'
required: true
default: production
type: choice
options:
- staging
- production
push:
branches: [ main ]
paths:
- 'content/sites/groupdocs/**'
jobs:
targets:
uses: ./.github/workflows/resolve_targets.yml
with:
# Manual runs pick freely; every push refreshes staging only (see the note above).
environment_override: ${{ github.event_name == 'workflow_dispatch' && inputs.environment || 'staging' }}
refresh:
needs: targets
if: ${{ needs.targets.outputs.environments != '[]' }}
runs-on: ubuntu-latest
strategy:
max-parallel: 1
matrix:
environment: ${{ fromJSON(needs.targets.outputs.environments) }}
# Coalesce bursts of content pushes; the latest content state is what we want indexed.
# Keyed on the ENVIRONMENT, not the branch: once both environments deploy from `main`,
# a branch-keyed group would make a staging refresh cancel a production one.
concurrency:
group: search-index-${{ matrix.environment }}
cancel-in-progress: true
env:
ENVIRONMENT: ${{ matrix.environment }}
steps:
- uses: actions/checkout@v4
- name: Build search-index.json from source
run: python3 scripts/build_search_index.py --source content/sites/groupdocs --out search-index.json
- name: Deploy search-index.json to bucket root
run: |
BUCKET=${{ env.ENVIRONMENT == 'production' && 'reference.groupdocs.com' || 'reference2.groupdocs.com' }}
aws s3 cp search-index.json "s3://$BUCKET/search-index.json" \
--content-type "application/json; charset=utf-8" --region us-west-2
env:
AWS_ACCESS_KEY_ID: ${{ secrets.ACCESS_KEY }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.SECRET_ACCESS }}
- name: Build llms-full.txt from source
run: |
BASE=${{ env.ENVIRONMENT == 'production' && 'https://reference.groupdocs.com' || 'https://reference2.groupdocs.com' }}
python3 scripts/build_llms_full.py --source content/sites/groupdocs --base-url "$BASE" --out llms-full.txt
- name: Deploy llms-full.txt to bucket root
run: |
BUCKET=${{ env.ENVIRONMENT == 'production' && 'reference.groupdocs.com' || 'reference2.groupdocs.com' }}
aws s3 cp llms-full.txt "s3://$BUCKET/llms-full.txt" \
--content-type "text/plain; charset=utf-8" --region us-west-2
env:
AWS_ACCESS_KEY_ID: ${{ secrets.ACCESS_KEY }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.SECRET_ACCESS }}
- name: Invalidate CloudFront
uses: chetan/invalidate-cloudfront-action@v2
env:
DISTRIBUTION: ${{ env.ENVIRONMENT == 'production' && secrets.AWS_DISTRIBUTION_PROD || secrets.AWS_DISTRIBUTION }}
PATHS: '/search-index.json /llms-full.txt'
AWS_REGION: 'us-west-2'
AWS_ACCESS_KEY_ID: ${{ secrets.ACCESS_KEY }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.SECRET_ACCESS }}