diff --git a/.github/workflows/wiki-generate-blueprints.yaml b/.github/workflows/wiki-generate-blueprints.yaml new file mode 100644 index 0000000000..0742809405 --- /dev/null +++ b/.github/workflows/wiki-generate-blueprints.yaml @@ -0,0 +1,84 @@ +name: FAF Wiki Generator for Blueprints + +on: + workflow_dispatch: + +jobs: + + generate-blueprints: + runs-on: ubuntu-latest + defaults: + run: + shell: bash + + steps: + # Checkout repos, FA repo is sparse checkout as it is quite large + - name: Checkout Brewlan Wikigen Repository + uses: actions/checkout@v4 + with: + repository: The-Balthazar/BrewWikiGen + ref: master + path: ./brew-wiki-gen + # FA repo is sparse checkout as it is quite large and we dont won't to incur higher action minutes for no reason + - name: Checkout FAF Repository # -png folder doesnt exist yet, confirm location. + uses: actions/checkout@v4 + with: + repository: FAForever/fa + ref: deploy/develop + path: ./fa + sparse-checkout-cone-mode: | + wiki + loc + lua/ui/help/unitscription.lua + lua/ui/help/tooltips.lua + lua/sim/AdjacencyBuffs.lua + lua/system/Blueprints.lua + units/*_unit.bp + units/*_LOD0.scm + projectiles + + - name: Checkout FAF Wiki Repository + uses: actions/checkout@v4 + with: + repository: FAForever/fa.wiki + ref: master + path: ./fa.wiki + + - name: Install Lua 5.4 + uses: leafo/gh-actions-lua@v10 + with: + luaVersion: "5.4" + + - name: Replace run.lua + run: | + sudo mv fa/wiki/Run.lua brew-wiki-gen/Run.lua + + - name: Execute lua run + run: | + lua brew-wiki-gen/Run.lua --OutputDirectory="fa.wiki/" --WikiGeneratorDirectory="brew-wiki-gen/" --FADirectory="fa/" + + + - name: Upload as artifact + uses: actions/upload-artifact@v4 + with: + name: Wiki + path: fa.wiki + + #- name: Store the game version + # id: gameVersionJSON # but it is a string here! + # working-directory: app/data + # run: | + # json=`cat ./version.json` + # echo "json=$json" >> $GITHUB_OUTPUT + + #- name: Update Wiki repository # but it is a string here! + # working-directory: fa.wiki + # run: | + # git config user.email "administrator@faforever.com" + # git config user.name "FAForever" + + # git stage . + # git commit -m "Update generated data to game version ${{ fromJson(steps.gameVersionJSON.outputs.json).version}}" + # git push origin HEAD:master + + diff --git a/.github/workflows/wiki-generate-icons.yaml b/.github/workflows/wiki-generate-icons.yaml new file mode 100644 index 0000000000..9e37bab8da --- /dev/null +++ b/.github/workflows/wiki-generate-icons.yaml @@ -0,0 +1,73 @@ +name: FAF Wiki Generator for icons + +on: + workflow_dispatch: + +jobs: + + generate-icons: + runs-on: ubuntu-latest + defaults: + run: + shell: bash + + steps: + # Checkout repos + + # FA repo is sparse checkout as it is quite large and we dont won't to incur higher action minutes for no reason + - name: Checkout FAF Repository # -png folder doesnt exist yet, confirm location. + uses: actions/checkout@v4 + with: + repository: FAForever/fa + ref: deploy/develop + path: ./fa + sparse-checkout: | + wiki + textures/ui/common/game/strategicicons + textures/ui/common/icons/units + + - name: Checkout FAF Wiki Repository + uses: actions/checkout@v4 + with: + repository: FAForever/fa.wiki + ref: master + path: ./fa.wiki + + - name: Install Image Magick + run: | + sudo apt-get install -y imagemagick + + # copy strategic and unit icons and convert them to PNGs. Assume this should be going to the wiki location not the fa repo + - name: Convert Strategic Icons + working-directory: fa + run: | + wiki/icons-convert-strategic.sh + wiki/icons-convert-unit.sh + + - name: Move Strategic Icons + run: | + mv -f fa/wiki/generated/strategicicons/*.png fa.wiki/icons/strategicicons + mv -f fa/wiki/generated/units/*.png fa.wiki/icons/units + + - name: Upload as artifact + uses: actions/upload-artifact@v4 + with: + name: Wiki + path: fa.wiki + + # - name: Store the game version + # id: gameVersionJSON # but it is a string here! + # working-directory: app/data + # run: | + # json=`cat ./version.json` + # echo "json=$json" >> $GITHUB_OUTPUT + + # - name: Update Wiki repository # but it is a string here! + # working-directory: fa.wiki + # run: | + # git config user.email "administrator@faforever.com" + # git config user.name "FAForever" + + # git stage . + # git commit -m "Update generated data to game version ${{ fromJson(steps.gameVersionJSON.outputs.json).version}}" + # git push origin HEAD:master \ No newline at end of file diff --git a/changelog/snippets/other.6188.md b/changelog/snippets/other.6188.md new file mode 100644 index 0000000000..c7056280dd --- /dev/null +++ b/changelog/snippets/other.6188.md @@ -0,0 +1 @@ +- (#6188) Create a Github workflow to automate the population of the Wiki diff --git a/tests/run-syntax-test.sh b/tests/run-syntax-test.sh index 8eee6bc8d3..c73c7c8b34 100644 --- a/tests/run-syntax-test.sh +++ b/tests/run-syntax-test.sh @@ -26,8 +26,10 @@ while read file; do if [ "$file" != "./.vscode/fa-plugin.lua" ]; then if [ "$file" != "./lua/system/class.lua" ]; then if [ "$file" != "./lua/sim/NavGenerator.lua" ]; then - check_file "$file" - (( files_checked++ )) + if [ "$file" != "./wiki/Run.lua" ]; then + check_file "$file" + (( files_checked++ )) + fi fi fi fi diff --git a/wiki/Run.lua b/wiki/Run.lua index d5c79837c7..571272619e 100644 --- a/wiki/Run.lua +++ b/wiki/Run.lua @@ -8,20 +8,52 @@ --[[ ---------------------------------------------------------------------- ]]-- local OutputDirectory = "D:/faf-development/fa.wiki/" local WikiGeneratorDirectory = "D:/faf-development/BrewWikiGen/" +local FADirectory = "D:/faf-development/fa/" + +-- This section deals with overriding the OutputDirectory and WikiGeneratorDirectory if required +local function parse_args(arg) + local args = {} + for i = 1, #arg do + local key, value = arg[i]:match("--([^=]+)=(.*)") + if key and value then + key = key:gsub("^%-+", "") -- Remove leading '-' characters + args[key] = value + end + end + return args +end + +local args = parse_args(arg) + +-- Overwrite default values if provided as command-line arguments +if args["OutputDirectory"] then + OutputDirectory = args["OutputDirectory"] +end +if args["WikiGeneratorDirectory"] then + WikiGeneratorDirectory = args["WikiGeneratorDirectory"] +end +if args["FADirectory"] then + FADirectory = args["FADirectory"] +end + +print("Directories set") +print("Output Directory: " ..OutputDirectory) +print("Wiki Generator Directory: " ..WikiGeneratorDirectory) +print("FA Directory: " ..FADirectory) EnvironmentData = { name = 'Forged Alliance Forever', author = 'Gas Powered Games', version = '1.6.6', icon = false, - location = 'D:/faf-development/fa/', + location = FADirectory, GenerateWikiPages = true, --Generate pages for env blueprints RebuildBlueprints = true, --Rebuild env blueprints RunSanityChecks = false, --Sanity check env bps - Lua = 'D:/faf-development/fa/', - LOC = 'D:/faf-development/fa/', + Lua = FADirectory, + LOC = FADirectory, -- ExtraData = '', PreModBlueprints = {}, @@ -46,7 +78,7 @@ WikiOptions = { BuildListSaysModUnits = true, OnlineRepoUnitPageBlueprintLink = 'https://github.com/FAForever/fa/', - LocalRepuUnitPageBlueprintLink = 'D:/faf-development/fa/', + LocalRepuUnitPageBlueprintLink = FADirectory, } RebuildBlueprintOptions = { diff --git a/wiki/icons-convert-strategic.sh b/wiki/icons-convert-strategic.sh old mode 100644 new mode 100755 index d642c369ee..03c70fb4d7 --- a/wiki/icons-convert-strategic.sh +++ b/wiki/icons-convert-strategic.sh @@ -32,6 +32,6 @@ fi mkdir "wiki/generated/strategicicons" -magick mogrify -path "wiki/generated/strategicicons" -format png "textures/ui/common/game/strategicicons/*.dds" +mogrify -path "wiki/generated/strategicicons" -format png "textures/ui/common/game/strategicicons/*.dds" -read -p "Press enter to continue" +#read -p "Press enter to continue" diff --git a/wiki/icons-convert-unit.sh b/wiki/icons-convert-unit.sh old mode 100644 new mode 100755 index c9277da336..3d41636235 --- a/wiki/icons-convert-unit.sh +++ b/wiki/icons-convert-unit.sh @@ -32,6 +32,6 @@ fi mkdir "wiki/generated/units" -magick mogrify -path "wiki/generated/units" -format png "textures/ui/common/icons/units/*.dds" +mogrify -path "wiki/generated/units" -format png "textures/ui/common/icons/units/*.dds" -read -p "Press enter to continue" +#read -p "Press enter to continue"