diff --git a/.github/workflows/build-and-deploy.yml b/.github/workflows/build-and-deploy.yml index 2664e4f1..a302093b 100644 --- a/.github/workflows/build-and-deploy.yml +++ b/.github/workflows/build-and-deploy.yml @@ -2,7 +2,7 @@ name: Build and Deploy Docusaurus Documentation on: repository_dispatch: - types: [docs-update] + types: [docs-update, docs-version-deploy] workflow_dispatch: inputs: version: @@ -52,7 +52,7 @@ jobs: git fetch --all --tags # Determine version to checkout - VERSION="${{ github.event.inputs.version || 'latest' }}" + VERSION="${{ github.event.client_payload.version || github.event.inputs.version || 'latest' }}" if [ "$VERSION" = "latest" ] || [ -z "$VERSION" ]; then LSBRANCH="${{ github.event.inputs.ogx_branch || 'main' }}" LSBRANCH="${LSBRANCH:-main}" @@ -358,6 +358,32 @@ jobs: echo "ℹ️ No changes to commit" fi + - name: Update versionsArchived.json + if: env.BUILDING_LATEST != 'true' + run: | + cd "${{ github.workspace }}" + + TAG="${{ env.VERSION_TAG }}" + python3 -c " + import json + with open('versionsArchived.json') as f: + archived = json.load(f) + tag = '${TAG}' + url = 'https://ogx-ai.github.io/${TAG}/' + if tag not in archived: + archived[tag] = url + def version_key(item): + parts = item[0].lstrip('v').split('.') + return [int(p) for p in parts if p.isdigit()] + archived = dict(sorted(archived.items(), key=version_key, reverse=True)) + with open('versionsArchived.json', 'w') as f: + json.dump(archived, f, indent=2) + f.write('\n') + " + git add versionsArchived.json + git diff --staged --quiet || git commit -s -m "docs: add ${TAG} to versionsArchived.json" + git push + - name: Setup GitHub Pages if: ${{ github.event.inputs.action == 'build-and-deploy' || github.event_name == 'repository_dispatch' }} uses: actions/configure-pages@v5 diff --git a/versions.html b/versions.html index c0de355d..efa4c556 100644 --- a/versions.html +++ b/versions.html @@ -1,56 +1,12 @@ - + - - ogx Documentation Versions - + + + Redirecting... -

ogx Docs

-

All versions of the ogx documentation.

- -
-
Latest
- Current documentation -
- -

Previous versions

- - -
- ← Back to docs -
+

Redirecting to /versions...