Aaron Suen
8f06601e86
Begin rebuilding to use new CDB API
Since writing cdbrelease, CDB has added a new set of stable APIs suitable for creating releases. Major changes planned: - Use the JSON API and token auth for everything instead of scraping site HTML. - Switch to using CDB's standard mechanisms for some config, such as *.conf for versions and .cdb.json for static settings. - Switch to zip uploads so we can locally control exports, since CDB uses git-export-all which does not properly support .gitattributes export-subst. This also involves a significant rework of the configuration interfaces to support the new .cdb.json source, and mirroring the git repo is now mandatory, as using zip upload, we cannot rely on CDB to access the repo itself directly. New configuration interfaces are ostensibly done, CDB components need to be reworked still.
======================================================================== ........................................................................ Prerequisites: - You must have an existing account on content.minetest.net, and must have an API Token configured. - You must have already setup your package; this script will not create new packages for you. - Your package must use VCS for release, and have the source repo URL already registered; file upload is not supported here. ........................................................................ Installation: - Have nodejs (and npm if packaged separately) installed. - Clone/download the project. - Run "npm i" in the project dir to install dependencies. ........................................................................ Configuration: Configuration is read from the following sources, from high to low priority (highest priority overrides all others): - command line options - git repository .cdbrelease.lua - git repository .cdb.json - local .cdbrelease.json config file - internal defaults Note that settings that are used to locate other sources of config (e.g. the config file path or git repository url) can only be meaningfully defined in config sources that are available before those sources have been loaded. Settings become available in the order: - internal defaults - command line options - local .cdbrelease.json config file - git repository .cdb.json - git repository .cdbrelease.lua Recognized settings: - conf: path to local config file, default' ~/.cdbrelease.json'. - repo: REQUIRED path or URL to a git repository from which to create the release; must have access to clone. - branch: git ref/branch/tag from the source repo to release, defaults to master. - execgit: path to execute git command, default 'git' (using $PATH) - exectar: path to execute tar command, default 'tar' (using $PATH) - execlua: path to execute lua 5.1 command, default 'lua5.1' (using $PATH) - cdbjson: enable this option to enable processing configuration from the .cdb.json file embedded inside the repo. WARNING: only do this if you trust the repository; any setting can be defined in the file. - cdbjsonpath: relative path to .cdb.json within git checkout/export, default '.cdb.json'. - cdblua: enable this option to enable processing dynamic lua config from inside the repo; a lua script embedded in the repo will be EXECUTED and can return config values. WARNING: only do this if you trust the repository highly, and you're running adequately sandboxed (e.g. VM/container); any setting can be defined, and arbitrary code will be executed. - cdbluapath: relative path to .cdbrelease.lua within the git checkout/export, default '.cdbrelease.lua'. ======================================================================== To create a release manually: - In this project's dir, run: node . --user="yourname" --token="yourapitoken" --pkg="yourpackage" \ --version="new-version-title" - You can also set optional parameters: --branch="..." to set the VCS source branch, if not master. --min="..." to set the minimum Minetest version. --max="..." to set the maximum Minetest version. --fromgit="..." (see below) - If a release with a matching name is detected then the release will be aborted. Don't rely on this too much, as it may be fragile, e.g. not work if a release exists but is pending approval. - No news is good news. If you don't see anything then it probably worked. Check on content.minetest.net to be certain. ........................................................................ To create a release automatically from a git repo: - Create a .cdbrelease.lua file in the root of your project's git repo. This should return a lua table containing key/value pairs to merge into config (e.g. {version = "123"} maps to --version=123). You can use .gitattributes and export tags. - Commit (and if necessary push). - In this project's dir, run: node . --user="yourname" --token="yourapitoken" --repo="repourl" - "repourl" should be anything that git can clone, including a local path, a web URL, ssh URL, etc. - You can also optionally set any parameters listed above in the "release manually" section. Anything set locally will override the settings from the repo. Technically you can store your username and API Token in the repo, but this is bad practice. N.B. code in .cdbrelease.lua is NOT sandboxed in any way! There are significant security implications to using --repo with a repo that you do not fully control. Use at your own risk. ========================================================================
Description
Languages
JavaScript
89%
Lua
9.8%
Dockerfile
1.2%