Skip to content

Commit 8f7f726

Browse files
authored
Merge pull request #2 from sipsuru/node-to-py
Node toPy
2 parents 8c8b861 + c16fbe1 commit 8f7f726

File tree

10 files changed

+101
-938
lines changed

10 files changed

+101
-938
lines changed

.github/workflows/cp__latest_dispatch.yml

Lines changed: 15 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -10,38 +10,32 @@ jobs:
1010
scraped_version: ${{ steps.set_scraped_version.outputs.scraped_version }}
1111

1212
env:
13-
NODE_JS_VERSION: 22.9.0
13+
PYTHON_VERSION: 3.12.6
1414

1515
steps:
16-
- uses: actions/checkout@v4
17-
18-
- name: Use Node.js ${{ env.NODE_JS_VERSION }}
19-
uses: actions/setup-node@v4
20-
with:
21-
node-version: ${{ env.NODE_JS_VERSION }}
16+
- name: Checkout repository
17+
uses: actions/checkout@v4
2218

23-
- name: Cache Node.js dependencies
24-
uses: actions/cache@v4
19+
- name: Setup Python ${{ env.PYTHON_VERSION }}
20+
uses: actions/setup-python@v5
2521
with:
26-
path: utils/fe-version-scraper/node_modules
27-
key: ${{ runner.os }}-node-${{ env.NODE_JS_VERSION }}-${{ hashFiles('utils/fe-version-scraper/package-lock.json') }}
28-
restore-keys: |
29-
${{ runner.os }}-node-${{ env.NODE_JS_VERSION }}-
22+
python-version: ${{ env.PYTHON_VERSION }}
3023

31-
- name: Install Node.js dependencies
32-
run: npm ci
33-
working-directory: utils/fe-version-scraper
34-
35-
- name: Run the Node.js script
36-
run: node .
37-
working-directory: utils/fe-version-scraper
24+
- name: Install dependencies
25+
run: |
26+
python -m pip install --upgrade pip
27+
pip install requests beautifulsoup4
3828
29+
- name: Run Python Script
30+
run: python utils/fe-version-scraper/fe-version-scraper.py --latest
31+
3932
- name: Read & Set Env
4033
id: set_scraped_version
34+
shell: pwsh
4135
run: |
4236
$fileContent = Get-Content -Path "utils/fe-version-scraper/latest_version.txt" -Raw
4337
echo "scraped_version=$fileContent" | Out-File -Append -FilePath $env:GITHUB_OUTPUT
44-
38+
4539
download-yukihana-patch:
4640
runs-on: windows-latest
4741
needs:

.github/workflows/cp_dispatch.yml

Lines changed: 14 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -19,37 +19,30 @@ jobs:
1919
is_valid: ${{ steps.get_validity.outputs.is_valid }}
2020

2121
env:
22-
NODE_JS_VERSION: 22.9.0
22+
PYTHON_VERSION: 3.12.6
2323

2424
steps:
25-
- uses: actions/checkout@v4
26-
27-
- name: Use Node.js ${{ env.NODE_JS_VERSION }}
28-
uses: actions/setup-node@v4
29-
with:
30-
node-version: ${{ env.NODE_JS_VERSION }}
25+
- name: Checkout repository
26+
uses: actions/checkout@v4
3127

32-
- name: Cache Node.js dependencies
33-
uses: actions/cache@v4
28+
- name: Setup Python ${{ env.PYTHON_VERSION }}
29+
uses: actions/setup-python@v5
3430
with:
35-
path: utils/fe-version-validator/node_modules
36-
key: ${{ runner.os }}-node-${{ env.NODE_JS_VERSION }}-${{ hashFiles('utils/fe-version-validator/package-lock.json') }}
37-
restore-keys: |
38-
${{ runner.os }}-node-${{ env.NODE_JS_VERSION }}-
39-
40-
- name: Install Node.js dependencies
41-
run: npm ci
42-
working-directory: utils/fe-version-validator
31+
python-version: ${{ env.PYTHON_VERSION }}
4332

44-
- name: Run the Node.js script
45-
run: node .
46-
working-directory: utils/fe-version-validator
33+
- name: Install dependencies
34+
run: |
35+
python -m pip install --upgrade pip
36+
pip install requests beautifulsoup4
4737
38+
- name: Run Python Script
39+
run: python utils/fe-version-scraper/fe-version-scraper.py --all
40+
4841
- name: Get Version Validity
4942
id: get_validity
5043
shell: pwsh
5144
run: |
52-
$filePath = "utils/fe-version-validator/versions.txt"
45+
$filePath = "utils/fe-version-scraper/versions.txt"
5346
$isValid = 'false'
5447
$patchingVersion = $env:VERSION_TO_PATCH
5548

.github/workflows/cp_main.yml

Lines changed: 13 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -18,31 +18,24 @@ jobs:
1818
scraped_version: ${{ steps.set_scraped_version.outputs.scraped_version }}
1919

2020
env:
21-
NODE_JS_VERSION: 22.9.0
21+
PYTHON_VERSION: 3.12.6
2222

2323
steps:
24-
- uses: actions/checkout@v4
24+
- name: Checkout repository
25+
uses: actions/checkout@v4
2526

26-
- name: Use Node.js ${{ env.NODE_JS_VERSION }}
27-
uses: actions/setup-node@v4
27+
- name: Setup Python ${{ env.PYTHON_VERSION }}
28+
uses: actions/setup-python@v5
2829
with:
29-
node-version: ${{ env.NODE_JS_VERSION }}
30+
python-version: ${{ env.PYTHON_VERSION }}
3031

31-
- name: Cache Node.js dependencies
32-
uses: actions/cache@v4
33-
with:
34-
path: utils/fe-version-scraper/node_modules
35-
key: ${{ runner.os }}-node-${{ env.NODE_JS_VERSION }}-${{ hashFiles('utils/fe-version-scraper/package-lock.json') }}
36-
restore-keys: |
37-
${{ runner.os }}-node-${{ env.NODE_JS_VERSION }}-
38-
39-
- name: Install Node.js dependencies
40-
run: npm ci
41-
working-directory: utils/fe-version-scraper
42-
43-
- name: Run the Node.js script
44-
run: node .
45-
working-directory: utils/fe-version-scraper
32+
- name: Install dependencies
33+
run: |
34+
python -m pip install --upgrade pip
35+
pip install requests beautifulsoup4
36+
37+
- name: Run Python Script
38+
run: python utils/fe-version-scraper/fe-version-scraper.py --latest
4639

4740
- name: Read & Set Env
4841
id: set_scraped_version

utils/fe-version-scraper/fe-version-scraper.js

Lines changed: 0 additions & 27 deletions
This file was deleted.
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
import requests
2+
from bs4 import BeautifulSoup
3+
import re
4+
5+
def get_latest_version():
6+
try:
7+
url = 'https://www.telerik.com/support/whats-new/fiddler-everywhere/release-history'
8+
response = requests.get(url)
9+
response.raise_for_status()
10+
11+
soup = BeautifulSoup(response.content, 'html.parser')
12+
version_text = soup.find('a', string=re.compile(r'Fiddler Everywhere v')).text
13+
latest_version = re.search(r'(\d+\.\d+\.\d+)', version_text).group(0)
14+
15+
print(f"Latest Version: {latest_version}")
16+
17+
# Save the version to a file
18+
with open('latest_version.txt', 'w') as f:
19+
f.write(latest_version)
20+
21+
except Exception as e:
22+
print(f"Error fetching latest version: {e}")
23+
24+
def get_all_versions():
25+
try:
26+
url = 'https://www.telerik.com/support/whats-new/fiddler-everywhere/release-history'
27+
response = requests.get(url)
28+
response.raise_for_status()
29+
30+
soup = BeautifulSoup(response.content, 'html.parser')
31+
versions = []
32+
for a in soup.find_all('a', string=re.compile(r'Fiddler Everywhere v')):
33+
version_match = re.search(r'(\d+\.\d+\.\d+)', a.text)
34+
if version_match:
35+
versions.append(version_match.group(0))
36+
37+
print("All Versions:", versions)
38+
39+
# Save the versions to a file, one per line
40+
with open('versions.txt', 'w') as f:
41+
f.write('\n'.join(versions))
42+
print('Version numbers saved to versions.txt')
43+
44+
except Exception as e:
45+
print(f"Error fetching all versions: {e}")
46+
47+
if __name__ == "__main__":
48+
import argparse
49+
50+
parser = argparse.ArgumentParser(description='Fetch Fiddler Everywhere version information')
51+
parser.add_argument('--latest', action='store_true', help='Get the latest version')
52+
parser.add_argument('--all', action='store_true', help='Get all versions')
53+
54+
args = parser.parse_args()
55+
56+
if args.latest:
57+
get_latest_version()
58+
if args.all:
59+
get_all_versions()

0 commit comments

Comments
 (0)