From 05efbb77ff1fcd586827f314c1ef1834962348cd Mon Sep 17 00:00:00 2001 From: selmankoc Date: Fri, 7 Feb 2025 15:15:43 +0300 Subject: [PATCH] Revert "Update update-versions.yml github action pipeline" This reverts commit 45fdc686fa19830045a97da8f648e6d481c03248. --- .github/workflows/update-versions.yml | 74 ++++++++++++--------------- 1 file changed, 33 insertions(+), 41 deletions(-) diff --git a/.github/workflows/update-versions.yml b/.github/workflows/update-versions.yml index a46f7d6076f..d0a295884fd 100644 --- a/.github/workflows/update-versions.yml +++ b/.github/workflows/update-versions.yml @@ -1,41 +1,33 @@ -import os -import json -import xml.etree.ElementTree as ET - -def get_version_from_common_props(): - """ common.props dosyasındaki versiyon bilgilerini çeker. """ - tree = ET.parse("common.props") - root = tree.getroot() - - version = root.find(".//Version").text - leptonx_version = root.find(".//LeptonXVersion").text - - return version, leptonx_version - -def update_latest_versions(): - version, leptonx_version = get_version_from_common_props() - - # Eğer versiyon "preview" içeriyorsa PR oluşturma (sadece stable versiyonlar için) - if "preview" in version or "rc" in version: - return False - - with open("latest-versions.json", "r") as f: - latest_versions = json.load(f) - - # Yeni versiyon bilgisini en üst sıraya ekle - new_version_entry = { - "version": version, - "releaseDate": "", - "type": "stable", - "message": "", - "leptonx": { - "version": leptonx_version - } - } - - latest_versions.insert(0, new_version_entry) # Yeni versiyonu en üste ekliyoruz - - with open("latest-versions.json", "w") as f: - json.dump(latest_versions, f, indent=2) - - return True +name: Update Latest Versions + +on: + release: + types: + - published + +permissions: + contents: write + pull-requests: write + +jobs: + update-versions: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: 3.x + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install PyGithub + + - name: Update latest-versions.json and create PR + env: + GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }} + run: | + python .github/scripts/update_versions.py