From 4418a026a9751bc6ed17a363b1f55a23a977f53c Mon Sep 17 00:00:00 2001 From: GenZmeY Date: Sun, 20 Feb 2022 04:24:39 +0300 Subject: [PATCH 1/2] Add auto-generated USAGE.md, update README.md and TODO.md --- .github/workflows/docs-autoupdate.yml | 41 +++++++++++++ README.md | 88 +++++++++++++++++++++++++-- TODO.md | 11 ++-- builder | 12 ++-- 4 files changed, 138 insertions(+), 14 deletions(-) create mode 100644 .github/workflows/docs-autoupdate.yml diff --git a/.github/workflows/docs-autoupdate.yml b/.github/workflows/docs-autoupdate.yml new file mode 100644 index 0000000..6485968 --- /dev/null +++ b/.github/workflows/docs-autoupdate.yml @@ -0,0 +1,41 @@ +name: docs-autoupdate + +on: + push: + branches: + - '*' + +jobs: + update-docs: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: Update docs + run: | + if ! [[ -e USAGE.md ]]; then touch USAGE.md; fi + mv USAGE.md USAGE.md.old + mkdir tools + cp ./builder ./tools/ + chmod +x ./tools/builder + echo '# KF2-BuildTools' >> USAGE.md + echo '[![title](https://img.shields.io/badge/Help-Page-w)](https://github.com/GenZmeY/KF2-BuildTools)' >> USAGE.md + echo '[![version](https://img.shields.io/github/v/tag/genzmey/KF2-BuildTools)](https://github.com/GenZmeY/KF2-BuildTools/tags)' >> USAGE.md + echo '[![docs-autoupdate](https://github.com/GenZmeY/KF2-BuildTools/actions/workflows/docs-autoupdate.yml/badge.svg)](https://github.com/GenZmeY/KF2-BuildTools/actions/workflows/docs-autoupdate.yml)' >> USAGE.md + echo '```' >> USAGE.md + ./tools/builder -nch >> USAGE.md + echo '```' >> USAGE.md + if ! cmp -s USAGE.md USAGE.md.old; then + git config --local user.email "github-actions[bot]@users.noreply.github.com" + git config --local user.name "github-actions" + git add USAGE.md + git commit -m "Update USAGE.md to version $(git describe 2> /dev/null)" + else + echo "No change, skip updating USAGE.md" + fi + - name: Push changes + uses: ad-m/github-push-action@master + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + branch: ${{ github.ref }} \ No newline at end of file diff --git a/README.md b/README.md index 5a5eaba..a582558 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,84 @@ -# KF2-BuildTools - -git submodule add https://github.com/GenZmeY/KF2-BuildTools tools -./tools/builder -i \ No newline at end of file +# KF2-BuildTools +[![version](https://img.shields.io/github/v/tag/genzmey/KF2-BuildTools)](https://github.com/GenZmeY/KF2-BuildTools/tags) +[![shellcheck](https://github.com/GenZmeY/KF2-BuildTools/actions/workflows/shellcheck-master.yml/badge.svg)](https://github.com/GenZmeY/KF2-BuildTools/actions/workflows/shellcheck-master.yml) +[![docs-autoupdate](https://github.com/GenZmeY/KF2-BuildTools/actions/workflows/docs-autoupdate.yml/badge.svg)](https://github.com/GenZmeY/KF2-BuildTools/actions/workflows/docs-autoupdate.yml) +[![license](https://img.shields.io/github/license/GenZmeY/KF2-Server-Extension)](LICENSE) + +## Features: +- Build, brew, test and upload to Steam Workshop; +- No need to edit KFEditor.ini at all; +- Sources can be stored in any path; +- Easily switch between different projects. + +## Add to your project +[git-bash](https://git-scm.com/) is the only thing you need. If you're already using git, you probably already have it. If not, [install it](https://git-scm.com/download/win). + +**There are two options to add KF2-BuildTools to your project:** + +### As git submodule +Make sure that the location of folders and files in your project is as follows (Correct it if it's not): +`//Classes/*uc` + +Open git-bash and go to your project: `cd ` +Then run the command: +`git submodule add https://github.com/GenZmeY/KF2-BuildTools tools` + +**updating build tools:** +Open git-bash and go to your project: `cd ` +Get updates with the following command: `pushd tools && git pull && popd` +Now if you run `git status` you can see that `tools` has changed: +``` +$ git status +On branch master +Your branch is up to date with 'origin/master'. + +Changes not staged for commit: + (use "git add ..." to update what will be committed) + (use "git restore ..." to discard changes in working directory) + modified: tools (new commits) + +no changes added to commit (use "git add" and/or "git commit -a") +``` +Commit the changes: `git add tools && git commit -m 'update tools'` + +### As standalone script +Just create a `tools` folder and put [builder](builder) there. +Now you can use the script in the same way as in the first case, but you will have to update it yourself. + +## If you are using someone else's project that has BuildTools... +If you haven't downloaded the project yet, just add `--recurse-submodules` when cloning it: +`git clone --recurse-submodules ` +If you have already downloaded the project, just run the command in the project folder: +`git submodule update --init --recursive` + +## Usage (Basic) +If you have a simple mutator or game mode, then the usage is also simple: +`./tools/builder --compile` build project +`./tools/builder --test` start project test +`./tools/builder --upload` upload/update your project to/in the steam workshop + +If you need help with commands, run: `./tools/builder --help`, or visit [this page](USAGE.md). + +## Usage (Advanced) +If your project contains several mutators, *.upk files, external dependencies, or you want to customize the whole process in more detail, then this section is for you. + +### Prepare +**UNDER CONSTRUCTION** + +### Compilation +**UNDER CONSTRUCTION** + +### Brewing +**UNDER CONSTRUCTION** + +### Testing +**UNDER CONSTRUCTION** + +### Uploading to steam workshop +**UNDER CONSTRUCTION** + +## Other +[TODO List](TODO.md) + +## License +[GNU GPLv3](LICENSE) diff --git a/TODO.md b/TODO.md index 787d2d2..ca9aa5c 100644 --- a/TODO.md +++ b/TODO.md @@ -1,5 +1,6 @@ -# TODO: -- write helpfull README.md -- add map upload support -- *.upk with it's own filesystem (like in weapon packs) -- add kf2 support in another steam library (`Steam\steamapps\libraryfolders.vdf` may help) +# TODO: +- write useful README.md +- add map upload support +- *.upk with it's own filesystem (like in weapon packs) +- add kf2 support in another steam library (`Steam\steamapps\libraryfolders.vdf` may help) +- add --init-publication-content parameter diff --git a/builder b/builder index 5fc9887..307ae54 100644 --- a/builder +++ b/builder @@ -25,11 +25,13 @@ trap cleanup SIGINT SIGTERM ERR EXIT function reg_readkey () # $1: path, $2: key { - cygpath -u "$( - reg query "$1" //v "$2" | \ - grep -F "$2" | \ - awk '{ $1=$2=""; print $0 }' | \ - sed -r 's|^\s*(.+)\s*|\1|g')" + if [[ "$OSTYPE" == "msys" || "$OSTYPE" == "cygwin" ]]; then + cygpath -u "$( + reg query "$1" //v "$2" | \ + grep -F "$2" | \ + awk '{ $1=$2=""; print $0 }' | \ + sed -r 's|^\s*(.+)\s*|\1|g')" + fi } # Whoami From 72be758b4212b0a7724be5a1cd0580e1ea690623 Mon Sep 17 00:00:00 2001 From: github-actions Date: Sun, 20 Feb 2022 01:25:14 +0000 Subject: [PATCH 2/2] Update USAGE.md to version v1.2.0-1-g4418a02 --- USAGE.md | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 USAGE.md diff --git a/USAGE.md b/USAGE.md new file mode 100644 index 0000000..36a2352 --- /dev/null +++ b/USAGE.md @@ -0,0 +1,31 @@ +# KF2-BuildTools +[![title](https://img.shields.io/badge/Help-Page-w)](https://github.com/GenZmeY/KF2-BuildTools) +[![version](https://img.shields.io/github/v/tag/genzmey/KF2-BuildTools)](https://github.com/GenZmeY/KF2-BuildTools/tags) +[![docs-autoupdate](https://github.com/GenZmeY/KF2-BuildTools/actions/workflows/docs-autoupdate.yml/badge.svg)](https://github.com/GenZmeY/KF2-BuildTools/actions/workflows/docs-autoupdate.yml) +``` +Usage: ./tools/builder OPTIONS + +Build, pack, test and upload your kf2 packages to the Steam Workshop. + +Available options: + -ib, --init-build generate build.cfg with build parameters + -it, --init-test generate test.cfg with test parameters + -i, --init the same as "./builder --init-build; ./builder --init-test" + -c, --compile build package(s) + -b, --brew compress *.upk and place inside *.u + -bm, --brew-manual the same (almost) as above, but with patched kfeditor by @notpeelz + -u, --upload upload package(s) to the Steam Workshop + -t, --test run local single player test with test.cfg parameters + -q, --quiet run without output + -w, --warnings do not close kf2editor automatically (to be able to read warnings) + -nc, --no-colors do not use color output + -d, --debug print every executed command (script debug) + -v, --version show version + -h, --help show this help + +Short options can be combined, examples: + -cbu compile, brew, upload + -cbmt compile, brew_manual, run_test + -wcb compile and brew without closing kf2editor + etc... +```