name: Sync Link Checker Binary from docs-tooling on: workflow_dispatch: inputs: version: description: 'Link checker version to sync (e.g., v1.2.2)' required: true type: string jobs: sync-binary: name: Sync link-checker binary from docs-tooling runs-on: ubuntu-latest steps: - name: Checkout repository uses: actions/checkout@v4 - name: Download binary from docs-tooling release run: | echo "Downloading link-checker ${{ inputs.version }} from docs-tooling..." # Download binary from docs-tooling release using the GitHub API # NOTE: requires DOCS_TOOLING_TOKEN secret with read access to docs-tooling releases RELEASE_INFO=$(curl -sL \ -H "Accept: application/vnd.github+json" \ -H "Authorization: Bearer ${{ secrets.DOCS_TOOLING_TOKEN }}" \ "https://api.github.com/repos/influxdata/docs-tooling/releases/tags/link-checker-${{ inputs.version }}") # Check if release was found if echo "$RELEASE_INFO" | jq -e '.message == "Not Found"' >/dev/null 2>&1; then echo "❌ Release link-checker-${{ inputs.version }} not found in docs-tooling" exit 1 fi # Download linux binary asset BINARY_URL=$(echo "$RELEASE_INFO" | jq -r '.assets[] | select(.name == "link-checker-linux-x86_64") | .url') if [[ -z "$BINARY_URL" || "$BINARY_URL" == "null" ]]; then echo "❌ No linux binary found in release" echo "Available assets:" echo "$RELEASE_INFO" | jq -r '.assets[].name' exit 1 fi curl -sL \ -H "Accept: application/octet-stream" \ -H "Authorization: Bearer ${{ secrets.DOCS_TOOLING_TOKEN }}" \ -o link-checker-linux-x86_64 \ "$BINARY_URL" # Download checksums if available CHECKSUMS_URL=$(echo "$RELEASE_INFO" | jq -r '.assets[] | select(.name == "checksums.txt") | .url') if [[ -n "$CHECKSUMS_URL" && "$CHECKSUMS_URL" != "null" ]]; then curl -sL \ -H "Accept: application/octet-stream" \ -H "Authorization: Bearer ${{ secrets.DOCS_TOOLING_TOKEN }}" \ -o checksums.txt \ "$CHECKSUMS_URL" fi # Verify the binary is valid (not an error page) FILE_SIZE=$(stat -c%s link-checker-linux-x86_64 2>/dev/null || stat -f%z link-checker-linux-x86_64) if [[ "$FILE_SIZE" -lt 1000 ]]; then echo "❌ Downloaded binary is only ${FILE_SIZE} bytes - likely a failed download" echo "Content:" cat link-checker-linux-x86_64 exit 1 fi echo "✅ Downloaded binary: ${FILE_SIZE} bytes" ls -la link-checker-linux-x86_64 - name: Create docs-v2 release run: | echo "Creating link-checker-${{ inputs.version }} release in docs-v2..." # Collect assets to upload ASSETS="link-checker-linux-x86_64" if [[ -f checksums.txt ]]; then ASSETS="$ASSETS checksums.txt" fi gh release create \ --repo "${{ github.repository }}" \ --title "Link Checker Binary ${{ inputs.version }}" \ --notes "$(cat <