This directory contains utility scripts for the Portfolio project.
Python script for uploading files to Gofile.io and extracting true direct download links for CI/CD automation.
- Direct link extraction - Returns binary download URLs (not HTML landing pages)
- Format validation - Enforces
/download/requirement for automation - HTTP accessibility testing - Verifies links are downloadable
- Automatic server selection for optimal upload speed
- Support for authentication tokens and account IDs
- Folder organization support
- GitHub Actions integration with
$GITHUB_OUTPUT - Comprehensive error handling
- JSON output option
- CI/CD friendly
--direct-link-onlymode
# Basic upload (full output with direct link)
python scripts/upload_to_gofile.py path/to/file.apk --token YOUR_TOKEN
# CI/CD mode - output only the direct link
python scripts/upload_to_gofile.py path/to/file.apk \
--token YOUR_TOKEN \
--direct-link-only
# With GitHub Actions output
python scripts/upload_to_gofile.py path/to/file.apk \
--token YOUR_TOKEN \
--github-output
# With all options
python scripts/upload_to_gofile.py path/to/file.apk \
--token YOUR_TOKEN \
--account-id YOUR_ACCOUNT_ID \
--folder-id FOLDER_ID \
--output-json result.json \
--github-outputOutput includes:
- Landing Page:
https://gofile.io/d/{code}(HTML - NOT for automation) - Direct Link:
https://store*.gofile.io/download/web/{fileId}/{filename}(for CI/CD)
from upload_to_gofile import GofileUploader
uploader = GofileUploader(
token="YOUR_TOKEN",
account_id="YOUR_ACCOUNT_ID"
)
result = uploader.upload_file("path/to/file.apk")
print(f"Download URL: {result['download_page']}")Install dependencies with:
pip install -r scripts/requirements.txtTest suite directory containing all unit tests for Python scripts.
# Run all tests from scripts directory
cd scripts
python -m unittest discover -s test -p "test_*.py" -v
# Run specific test file
python -m unittest test.test_upload_to_gofile -v
# Run from project root
python -m unittest discover -s scripts/test -p "test_*.py" -vtest/test_upload_to_gofile.py- Unit tests forupload_to_gofile.py
The test suite includes 31 comprehensive unit tests organized into 8 test classes:
- Server retrieval (success, errors, edge cases)
- File upload (success, errors, timeouts)
- Network error handling
- Invalid response handling
- File path validation
- Successful folder publication
- Failure handling
- Exception handling
- HTTP accessibility testing (200, 302, 404)
- Network error handling
- Redirect detection
- API-based extraction
- Manual URL construction fallback
- Multiple field name support (link, directLink)
- Valid format enforcement
- Invalid format detection
- Complete workflow testing
- Folder extraction from download page
- CLI integration testing
- Custom exception handling
Total: 31 unit tests with 100% pass rate ✅
The upload script is integrated into the GitHub Actions workflow (firebase-hosting-merge.yml) and automatically:
- Builds the Android APK after the web build
- Sets up Python 3.11
- Installs dependencies
- Uploads the APK to Gofile.io
- Outputs the download URL to GitHub Actions logs
Configure these in GitHub Settings → Secrets and variables → Actions:
GOFILE_TOKEN: Your Gofile.io API tokenGOFILE_ACCOUNT_ID: Your Gofile.io account ID