Updated ci and release workflow

This commit is contained in:
Loup-Garou911XD 2025-01-15 04:15:39 +05:30
parent 0fd23a5063
commit 9c1ff8b0f2
4 changed files with 20 additions and 9 deletions

View file

@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.11"]
python-version: ["3.12"]
steps:
- uses: actions/checkout@v3
with:

View file

@ -16,7 +16,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
python-version: '3.12'
- name: 'Get Previous tag'
uses: oprypin/find-latest-tag@v1.1.2
@ -27,14 +27,16 @@ jobs:
- name: set_variables
run: |
output1=$(python3 test/get_latest.py)
output1=$(python3 test/get_latest.py get_latest_version)
{
echo "changelog<<EOF"
python3 test/get_changes.py "$(python3 test/get_latest.py)"
python3 test/get_changes.py "$(python3 test/get_latest.py get_latest_version)"
echo EOF
} >> "$GITHUB_OUTPUT"
output2=$(python3 test/get_latest.py get_latest_api)
output3=$(python3 test/version_is_lower.py ${{ steps.previoustag.outputs.tag }})
echo "latestVersion=$output1" >> $GITHUB_OUTPUT
echo "latestAPI=$output2" >> $GITHUB_OUTPUT
echo "shouldRun=$output3" >> $GITHUB_OUTPUT
id: set_variables
@ -54,7 +56,7 @@ jobs:
uses: ncipollo/release-action@v1
with:
tag: ${{ steps.tag_version.outputs.new_tag }}
name: Release ${{ steps.tag_version.outputs.new_tag }}
name: ${{ steps.tag_version.outputs.new_tag }} (api ${{ steps.set_variables.outputs.latestAPI }})
artifacts: "plugin_manager.py"
body: |
## Changelog

View file

@ -2,7 +2,7 @@
### 1.1.0 (15-01-2025)
- Updating to bombsquad api 9.
- Updated to bombsquad api 9.
### 1.0.23 (13-01-2025)

View file

@ -1,13 +1,22 @@
import json
import sys
def get_latest():
def get_latest_version():
"""Get latest version entry from index.json"""
with open('index.json', 'r') as file:
content = json.loads(file.read())
latest_version = list(content["versions"].keys())[0]
return latest_version
def get_latest_api():
"""Get latest api entry from index.json"""
with open('index.json', 'r') as file:
content = json.loads(file.read())
latest_api = content["versions"][get_latest_version()]["api_version"]
return latest_api
if __name__ == "__main__":
print(get_latest())
if len(sys.argv) < 2:
print(f"Usage: python3 {__file__.split('/')[-1]} function")
sys.exit(1)
print(globals()[sys.argv[1]]()) # used to call the fucntion passed as cli parameter