Skip to content

Update versions

Update versions #15

name: Update versions
# Refresh the SDK versions shown on the product family pages from the canonical feed
# https://products.groupdocs.com/versions.json. Upstream regenerates that file twice a day
# (06:00 + 18:00 UTC via its own GitHub Action), so we run +10 minutes later.
#
# scripts/update_versions.py trims the feed to just the fields we render (version + release-notes URL) and
# sorts keys, so data/versions.json only changes when a version actually moves (not on the upstream's
# generatedAt/downloads churn). We commit the data file to BOTH branches (keeping main == production) and
# then redeploy BOTH environments automatically — production (from `production`) and staging (from `main`) —
# each only when its own branch's data file actually changed.
on:
schedule:
- cron: '10 6,18 * * *' # 06:10 + 18:10 UTC (+10 min after upstream publishes versions.json)
workflow_dispatch:
inputs:
force:
description: Redeploy even if versions did not change
type: boolean
default: false
environment:
description: When forcing, which environment(s) to redeploy
type: choice
options: [both, production, staging]
default: both
permissions:
contents: write
concurrency:
group: update-versions
cancel-in-progress: false
jobs:
sync:
runs-on: ubuntu-latest
outputs:
prod_changed: ${{ steps.sync.outputs.prod_changed }}
staging_changed: ${{ steps.sync.outputs.staging_changed }}
steps:
- uses: actions/checkout@v4
with:
ref: production
fetch-depth: 0
- name: Fetch + transform versions.json
run: python3 scripts/update_versions.py --out /tmp/versions.json
- name: Commit data/versions.json on both branches (flag each branch that changed)
id: sync
env:
FORCE: ${{ github.event.inputs.force || 'false' }}
FORCE_ENV: ${{ github.event.inputs.environment || 'both' }}
run: |
git config user.name "groupdocs-version-bot"
git config user.email "groupdocs-version-bot@users.noreply.github.com"
git fetch origin production main
prod_changed=false
staging_changed=false
for BR in production main; do
git checkout -B "$BR" "origin/$BR"
cp /tmp/versions.json data/versions.json
if git diff --quiet -- data/versions.json; then
echo "[$BR] no version changes"
else
git add data/versions.json
git commit -m "Update SDK versions from products.groupdocs.com/versions.json"
git push origin "$BR"
echo "[$BR] versions updated"
if [ "$BR" = "production" ]; then prod_changed=true; else staging_changed=true; fi
fi
done
# Manual dispatch with force: redeploy the selected environment(s) even with no data change.
if [ "$FORCE" = "true" ]; then
case "$FORCE_ENV" in
production) prod_changed=true ;;
staging) staging_changed=true ;;
*) prod_changed=true; staging_changed=true ;;
esac
fi
echo "prod_changed=$prod_changed" >> "$GITHUB_OUTPUT"
echo "staging_changed=$staging_changed" >> "$GITHUB_OUTPUT"
echo "prod_changed=$prod_changed staging_changed=$staging_changed"
# Rebuild + redeploy the product family pages with the new versions. Only the 15 product builds
# render versions (home/aggregates don't), so we skip them. Each environment builds its own branch
# HEAD (the commit the sync job just pushed) via deploy_product's `ref` input, and runs only when
# that branch's data/versions.json actually changed.
deploy_production:
needs: sync
if: needs.sync.outputs.prod_changed == 'true'
strategy:
fail-fast: false
matrix:
product_family:
- annotation
- assembly
- classification
- comparison
- conversion
- editor
- markdown
- merger
- metadata
- parser
- redaction
- search
- signature
- viewer
- watermark
uses: ./.github/workflows/deploy_product.yml
with:
product_family: ${{ matrix.product_family }}
environment: production
ref: production
secrets: inherit
deploy_staging:
needs: sync
if: needs.sync.outputs.staging_changed == 'true'
strategy:
fail-fast: false
matrix:
product_family:
- annotation
- assembly
- classification
- comparison
- conversion
- editor
- markdown
- merger
- metadata
- parser
- redaction
- search
- signature
- viewer
- watermark
uses: ./.github/workflows/deploy_product.yml
with:
product_family: ${{ matrix.product_family }}
environment: staging
ref: main
secrets: inherit