Re-implement CI auto version increment for packaging (#7354)

* Only install Python deps with deps script

* Remove hard-coded Qt version in CI

* Add example .env

* Improve comments in .env file

* Simplify config reader and Choco CI config

* Actually return the config value

* Move deps before Qt version env call

* Remove `self.`

* Move venv ensure to main

* Fixed arg

* Move config import to function

* Move ensure_module to function

* Simplify over-complicated `Version.cmake`

* Move code to `github` module

* Use `symless/next-version-action`

* Make CMake version file even simpler

* Set version from tag

* Create release when master or release branch

* Don't run CI on master push, only release

* Fixed bac macro

* Use new version values

* Handle empty version env var

* Also strip version file value

* Remove quotes

* Add @master to action

* Read version from file

* Simplify version file read

* Fixed typo in env var

* Remove unused var

* Delete legacy build number action

* Fixed env var

* Version file read shouldn't be needed

* Remove weird and unnecessary include path

* Update ChangeLog

* Remove unused config value

* Better name for changelog check

* Delete broken Flatpak CI

* Run stale issue cron at midnight

* Update ChangeLog

* Add version input for manual run

* Print next version

* Fetch all tags

* Use more idiomatic approach

* Set to pre-release when master

* Remove unnecessary `commitish`

* Fixed wrong ID

* More specific IDs

* Reduce config needed for upload

* Only /release can be non-pre-release

* More discreet package path for gdrive

* Try without setting path

* Remove seemly unused step

* Better name for Qt version step

* Fixed bad var ref

* Better name for package dir

* Fixed bad input name

* Add missing shell

* Workflow to test upload action

* Remove fetch tags

* Use bash to cut version

* Remove name and make conditional

* Replace deprecated set-output

* Fixed env var name

* Missing dir sep char

* Add comment to test workflow

* Improve input descriptions

* Replace deprecated set-output
This commit is contained in:
Nick Bolton
2024-06-26 16:46:42 +01:00
committed by GitHub
parent 17c64e2f3a
commit 7103bbed6d
33 changed files with 277 additions and 5382 deletions

View File

@ -1,29 +1,30 @@
#!/usr/bin/env python3
import os
from lib import env
import argparse
from lib import env, github
from lib.config import Config
# important: load venv before loading modules that install deps.
env.ensure_in_venv(__file__)
github_key = "GITHUB_ENV"
version_key = "SYNERGY_VERSION"
qt_version_key = "QT_VERSION"
def main():
env_file = os.getenv(github_key)
if not env_file:
raise RuntimeError(f"Env var {github_key} not set")
parser = argparse.ArgumentParser()
parser.add_argument(
"--set-qt-version",
action="store_true",
help=f"Set {qt_version_key} env var",
)
args = parser.parse_args()
if not os.path.exists(env_file):
raise RuntimeError(f"File not found: {env_file}")
# important: load venv before loading modules that install deps.
env.ensure_in_venv(__file__)
major, minor, patch, stage, _build = env.get_version_info()
version_value = f"{major}.{minor}.{patch}-{stage}"
print(f"Setting env var: {version_key}={version_value}")
with open(env_file, "a") as env_file:
env_file.write(f"{version_key}={version_value}\n")
if args.set_qt_version:
config = Config()
_qt_mirror, qt_version, _qt_install_dir = config.get_qt_config()
github.set_env(qt_version_key, qt_version)
else:
raise RuntimeError("No option selected")
if __name__ == "__main__":