-
-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(docs): automatically add Supported Version to README (#521)
* (docs): add version for qbit / qbit api to readme (#523) (cherry picked from commit 37e560f) * (docs): automate supported versions for readme (docs): readme updates (chore): fix pre-commit increase_version * (chore): automate supported version updates --------- Co-authored-by: bakerboy448 <mailto:[email protected]>
- Loading branch information
1 parent
528615e
commit f115aca
Showing
6 changed files
with
132 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
name: Update Supported Versions | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
- develop | ||
paths: | ||
- "requirements.txt" | ||
workflow_dispatch: | ||
inputs: | ||
targetBranch: | ||
description: "Branch to run the script on (default: develop)" | ||
required: false | ||
default: "develop" | ||
|
||
permissions: | ||
contents: write | ||
pull-requests: write | ||
|
||
jobs: | ||
update-versions: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
with: | ||
ref: ${{ github.event.inputs.targetBranch || github.ref_name }} | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.x" | ||
|
||
- name: Install dependencies from requirements.txt | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install -r requirements.txt | ||
- name: Run update script | ||
run: python scripts/update-readme-version.py ${{ github.event.inputs.targetBranch || github.ref_name }} | ||
|
||
- name: Create Pull Request | ||
uses: peter-evans/create-pull-request@v4 | ||
with: | ||
commit-message: Update SUPPORTED_VERSIONS.json | ||
title: "Update SUPPORTED_VERSIONS.json for ${{ github.event.inputs.targetBranch || github.ref_name }}" | ||
branch: update-supported-versions-${{ github.event.inputs.targetBranch || github.ref_name }} | ||
base: develop | ||
body: "This PR updates the SUPPORTED_VERSIONS.json to reflect new versions." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"master": { | ||
"qbit": "v4.6.4", | ||
"qbitapi": "2024.3.60" | ||
}, | ||
"develop": { | ||
"qbit": "v4.6.4", | ||
"qbitapi": "2024.3.60" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
4.1.1-develop3 | ||
4.1.1-develop6 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import json | ||
import re | ||
import sys | ||
|
||
from qbittorrentapi import Version | ||
|
||
# Check if a branch name was provided | ||
if len(sys.argv) != 2: | ||
print("Usage: python update_versions.py <branch_name>") | ||
sys.exit(1) | ||
|
||
branch_name = sys.argv[1] | ||
print(f"Branch name: {branch_name}") | ||
|
||
# Load or initialize the SUPPORTED_VERSIONS.json file | ||
versions_file_path = "SUPPORTED_VERSIONS.json" | ||
try: | ||
with open(versions_file_path, encoding="utf-8") as file: | ||
supported_versions = json.load(file) | ||
except FileNotFoundError: | ||
supported_versions = {} | ||
|
||
# Extract the current qbittorrent-api version from requirements.txt | ||
print("Reading requirements.txt...") | ||
with open("requirements.txt", encoding="utf-8") as file: | ||
requirements = file.read() | ||
qbittorrent_api_version = re.search(r"qbittorrent-api==(.+)", requirements).group(1) | ||
|
||
print(f"Current qbittorrent-api version: {qbittorrent_api_version}") | ||
|
||
# Fetch the latest supported qBittorrent version | ||
supported_version = Version.latest_supported_app_version() | ||
print(f"Latest supported qBittorrent version: {supported_version}") | ||
|
||
# Ensure the branch is initialized in the dictionary | ||
if branch_name not in supported_versions: | ||
supported_versions[branch_name] = {} | ||
|
||
# Update the versions in the dictionary | ||
supported_versions[branch_name]["qbit"] = supported_version | ||
supported_versions[branch_name]["qbitapi"] = qbittorrent_api_version | ||
|
||
print("Writing updated versions to SUPPORTED_VERSIONS.json...") | ||
# Write the updated versions back to SUPPORTED_VERSIONS.json | ||
with open(versions_file_path, "w", encoding="utf-8") as file: | ||
json.dump(supported_versions, file, indent=4) |