mirror of
https://github.com/qgis/QGIS.git
synced 2025-10-04 00:04:03 -04:00
Add get_latest_qgis_version.py script
This commit is contained in:
parent
39b355c34f
commit
2f98e95757
16
.github/workflows/try-latest-version.yml
vendored
16
.github/workflows/try-latest-version.yml
vendored
@ -11,6 +11,12 @@ jobs:
|
|||||||
check_version_reported:
|
check_version_reported:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Get version details
|
||||||
|
run: |
|
||||||
|
python ./scripts/get_latest_qgis_versions.py --release="stable" --github_token=${{ secrets.GITHUB_TOKEN }} >> $GITHUB_ENV
|
||||||
- name: Write comment
|
- name: Write comment
|
||||||
uses: actions/github-script@v7
|
uses: actions/github-script@v7
|
||||||
with:
|
with:
|
||||||
@ -53,9 +59,9 @@ jobs:
|
|||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
// We need to update these variable when we release a new version
|
// Latest released version identified using get_latest_qgis_versions
|
||||||
var LATEST_LTR_RELEASE = "3.40.7"
|
var LATEST_LTR_RELEASE = {ENV.QGIS_VERSION_LTR_PATCH}
|
||||||
var LATEST_RELEASE = "3.42.3"
|
var LATEST_STABLE_RELEASE = {QGIS_VERSION_STABLE_PATCH}
|
||||||
|
|
||||||
// Match qgis version reported e.g : "3.40.0-Bratislava"
|
// Match qgis version reported e.g : "3.40.0-Bratislava"
|
||||||
var regex = /(\d)\.(\d{2})\.(\d*)-[A-Z]{1}[a-z]+/
|
var regex = /(\d)\.(\d{2})\.(\d*)-[A-Z]{1}[a-z]+/
|
||||||
@ -93,10 +99,10 @@ jobs:
|
|||||||
else if ( compareSemanticVersions(user_version, LATEST_LTR_RELEASE) === 0 ) {
|
else if ( compareSemanticVersions(user_version, LATEST_LTR_RELEASE) === 0 ) {
|
||||||
console.log("Debug: user is already running latest LTR version")
|
console.log("Debug: user is already running latest LTR version")
|
||||||
}
|
}
|
||||||
else if ( compareSemanticVersions(user_version, LATEST_RELEASE) === -1 ) {
|
else if ( compareSemanticVersions(user_version, LATEST_STABLE_RELEASE) === -1 ) {
|
||||||
console.log("Debug: Suggest user to try latest release")
|
console.log("Debug: Suggest user to try latest release")
|
||||||
|
|
||||||
let comment = `Thanks for reporting, however it looks like you are using an older version of QGIS (version ${user_version}) instead of latest (Version ${LATEST_RELEASE}). Your bug could already resolved in the latest version. \nIt takes a lot of human effort to triage all the bugs in a project like QGIS, could you please retry with the latest version first?`
|
let comment = `Thanks for reporting, however it looks like you are using an older version of QGIS (version ${user_version}) instead of latest (Version ${LATEST_STABLE_RELEASE}). Your bug could already resolved in the latest version. \nIt takes a lot of human effort to triage all the bugs in a project like QGIS, could you please retry with the latest version first?`
|
||||||
github.rest.issues.createComment({
|
github.rest.issues.createComment({
|
||||||
issue_number: context.issue.number,
|
issue_number: context.issue.number,
|
||||||
owner: context.repo.owner,
|
owner: context.repo.owner,
|
||||||
|
66
scripts/get_latest_qgis_versions.py
Normal file
66
scripts/get_latest_qgis_versions.py
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
import json
|
||||||
|
import re
|
||||||
|
|
||||||
|
import click
|
||||||
|
import requests
|
||||||
|
|
||||||
|
|
||||||
|
@click.command()
|
||||||
|
@click.option(
|
||||||
|
"--release",
|
||||||
|
help="Which release to extract. `ltr` or `stable` assume release are tagged as final-x_x_x or ltr-x_x_x",
|
||||||
|
)
|
||||||
|
@click.option(
|
||||||
|
"--github_token",
|
||||||
|
default=None,
|
||||||
|
help="Github token. Can help in case of rate limits.",
|
||||||
|
)
|
||||||
|
def extract(release, github_token):
|
||||||
|
r = requests.get(
|
||||||
|
"https://api.github.com/repos/qgis/QGIS/git/refs/tags",
|
||||||
|
headers={"Authorization": github_token},
|
||||||
|
)
|
||||||
|
r.raise_for_status()
|
||||||
|
tags = json.loads(r.text)
|
||||||
|
releases = dict()
|
||||||
|
current_ltr = None
|
||||||
|
current_release = None
|
||||||
|
for tag in tags:
|
||||||
|
ref = tag["ref"]
|
||||||
|
tag_name = ref.split("/")[-1]
|
||||||
|
if tag_name.startswith("final-"):
|
||||||
|
version_parts = re.split(r"[\-_]", tag_name)[1:]
|
||||||
|
if int(version_parts[0]) >= 3:
|
||||||
|
releases[version_parts[0] + "." + version_parts[1]] = ".".join(
|
||||||
|
version_parts
|
||||||
|
)
|
||||||
|
current_release = version_parts[0] + "." + version_parts[1]
|
||||||
|
if tag_name.startswith("ltr-"):
|
||||||
|
version_parts = re.split(r"[\-_]", tag_name)[1:]
|
||||||
|
version = ".".join(version_parts)
|
||||||
|
if version != current_release:
|
||||||
|
current_ltr = version
|
||||||
|
|
||||||
|
info = {
|
||||||
|
"ltr": {
|
||||||
|
"short_version": current_ltr,
|
||||||
|
"patch_version": releases[current_ltr],
|
||||||
|
"tag_name": f'final-{releases[current_ltr].replace(".", "_")}',
|
||||||
|
},
|
||||||
|
"stable": {
|
||||||
|
"short_version": current_release,
|
||||||
|
"patch_version": releases[current_release],
|
||||||
|
"tag_name": f'final-{releases[current_release].replace(".", "_")}',
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
print(f"QGIS_VERSION_STABLE_PATCH={info['stable']['patch_version']}")
|
||||||
|
print(f"QGIS_VERSION_LTR_PATCH={info['ltr']['patch_version']}")
|
||||||
|
|
||||||
|
print(f"QGIS_VERSION_SHORT={info[release]['short_version']}")
|
||||||
|
print(f"QGIS_VERSION_PATCH={info[release]['patch_version']}")
|
||||||
|
print(f"QGIS_VERSION_TAG={info[release]['tag_name']}")
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
extract()
|
Loading…
x
Reference in New Issue
Block a user