diff --git a/.github/workflows/update-docs-download.yml b/.github/workflows/update-docs-download.yml deleted file mode 100644 index e56ab8c..0000000 --- a/.github/workflows/update-docs-download.yml +++ /dev/null @@ -1,166 +0,0 @@ -# --------------------------------------------------------------------------- -# update-docs-download.yml -# -# Additive, non-destructive workflow that fires whenever a GitHub Release is -# published. It queries the release assets, picks the **largest** .exe file -# (the real NSIS installer, not the tiny Tauri stub), and patches the -# download link inside docs/index.html so visitors always get a one-click -# download of the latest installer. -# -# Nothing is deleted — only the href of the download button is updated. -# --------------------------------------------------------------------------- - -name: Update Docs Download Link - -on: - release: - types: [published] - workflow_dispatch: # manual trigger for testing - -permissions: - contents: write - -jobs: - update-download-link: - name: Patch docs/index.html with latest EXE URL - runs-on: ubuntu-latest - - steps: - - name: Checkout repository - uses: actions/checkout@v4 - with: - ref: master # always update the branch that serves GitHub Pages - - - name: Resolve latest installer URL - id: resolve - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - echo "Fetching latest release assets..." - - # Get all .exe assets from the triggering release (or latest if manual) - if [ "${{ github.event_name }}" = "release" ]; then - TAG="${{ github.event.release.tag_name }}" - else - TAG="$(gh release list --limit 1 --exclude-drafts --exclude-pre-releases --json tagName -q '.[0].tagName')" - fi - - echo "Release tag: $TAG" - - # List all .exe assets with their sizes, pick the largest one - ASSET_INFO=$(gh release view "$TAG" --json assets \ - -q '[.assets[] | select(.name | endswith(".exe"))] | sort_by(.size) | last | {url: .url, name: .name, size: .size}') - - if [ -z "$ASSET_INFO" ] || [ "$ASSET_INFO" = "null" ]; then - echo "::error::No .exe assets found in release $TAG" - exit 1 - fi - - ASSET_NAME=$(echo "$ASSET_INFO" | jq -r '.name') - ASSET_SIZE=$(echo "$ASSET_INFO" | jq -r '.size') - ASSET_SIZE_MB=$(echo "scale=1; $ASSET_SIZE / 1048576" | bc) - - # Build the direct browser-download URL - DOWNLOAD_URL="https://github.com/${{ github.repository }}/releases/download/${TAG}/${ASSET_NAME}" - - echo "Selected asset: $ASSET_NAME ($ASSET_SIZE_MB MB)" - echo "Download URL: $DOWNLOAD_URL" - - echo "download_url=$DOWNLOAD_URL" >> "$GITHUB_OUTPUT" - echo "asset_name=$ASSET_NAME" >> "$GITHUB_OUTPUT" - echo "asset_size_mb=$ASSET_SIZE_MB" >> "$GITHUB_OUTPUT" - echo "tag=$TAG" >> "$GITHUB_OUTPUT" - - - name: Update docs/index.html - env: - DOWNLOAD_URL: ${{ steps.resolve.outputs.download_url }} - ASSET_NAME: ${{ steps.resolve.outputs.asset_name }} - ASSET_SIZE: ${{ steps.resolve.outputs.asset_size_mb }} - TAG: ${{ steps.resolve.outputs.tag }} - run: | - FILE="docs/index.html" - - if [ ! -f "$FILE" ]; then - echo "::error::$FILE not found" - exit 1 - fi - - # 1. Update the data-download-url attribute (used by JS runtime fetcher) - # and the static fallback href on the main download button - python3 - "$FILE" "$DOWNLOAD_URL" "$ASSET_NAME" "$ASSET_SIZE" "$TAG" <<'PYEOF' - import sys, re - - file_path = sys.argv[1] - url = sys.argv[2] - asset_name = sys.argv[3] - size_mb = sys.argv[4] - tag = sys.argv[5] - - with open(file_path, "r", encoding="utf-8") as f: - html = f.read() - - # Update the nav Download link - html = re.sub( - r'({url}\2', - html, - ) - - # Update the data attributes on the download-installer link - html = re.sub( - r'(id="download-installer-btn"\s+href=")[^"]*(")', - rf'\g<1>{url}\2', - html, - ) - html = re.sub( - r'(data-download-url=")[^"]*(")', - rf'\g<1>{url}\2', - html, - ) - html = re.sub( - r'(data-asset-name=")[^"]*(")', - rf'\g<1>{asset_name}\2', - html, - ) - html = re.sub( - r'(data-asset-size=")[^"]*(")', - rf'\g<1>{size_mb}\2', - html, - ) - html = re.sub( - r'(data-release-tag=")[^"]*(")', - rf'\g<1>{tag}\2', - html, - ) - - # Update the visible version badge - html = re.sub( - r'(id="installer-version">)[^<]*()', - rf'\g<1>{tag} — {size_mb} MB\2', - html, - ) - - with open(file_path, "w", encoding="utf-8") as f: - f.write(html) - - print(f"Patched {file_path} → {url}") - PYEOF - - - name: Commit and push - run: | - git config user.name "github-actions[bot]" - git config user.email "github-actions[bot]@users.noreply.github.com" - - git add docs/index.html - - git diff --cached --quiet && { - echo "No changes to commit — docs already up to date." - exit 0 - } - - git commit -m "docs: update download link to ${{ steps.resolve.outputs.tag }} installer - - Asset: ${{ steps.resolve.outputs.asset_name }} (${{ steps.resolve.outputs.asset_size_mb }} MB) - URL: ${{ steps.resolve.outputs.download_url }}" - - git push origin master diff --git a/docs/index.html b/docs/index.html index d49a6b2..9106a65 100644 --- a/docs/index.html +++ b/docs/index.html @@ -501,7 +501,7 @@ Install Best Practices - Download + Download @@ -993,30 +993,6 @@
No PhD required. Just follow these steps and your AI will be farming while you sleep. Windows 10/11 for gameplay; training works on any OS.
- - - -- Or install from source using the steps below: -
-