diff --git a/.github/workflows/create-mod-release.yml b/.github/workflows/create-mod-release.yml deleted file mode 100644 index 48f6179..0000000 --- a/.github/workflows/create-mod-release.yml +++ /dev/null @@ -1,464 +0,0 @@ -name: "Create an OpenGOAL Mod Release" -on: - workflow_call: - inputs: - metadataSupportedGames: - description: "The supported games for the mod, can be comma-separated, supports `jak1|jak2|jak3|jakx`" - required: true - default: "jak4" - type: "string" - outputDir: - description: "The directory that the releases assets are created and temporarily stored in. Defaults to ./bundler" - required: false - default: "./bundler" - type: "string" - semverBump: - description: "What semver bump to use - patch|minor|major. Defaults to patch" - required: false - default: "patch" - type: "string" - releaseBranches: - description: "Comma separated list of branches (JavaScript regular expression accepted) that will generate the release tags. You probably want your default branch in this list." - required: false - default: "master,main" - type: "string" - buildBinaries: - description: "Whether to build binaries from source. Defaults to `false`, pulling binaries from `toolingRepo` instead." - required: false - default: false - type: "boolean" - toolingRepo: - description: "The repository from which the tooling is taken for the bundle. Defaults to open-goal/jak-project." - required: false - default: "open-goal/jak-project" - type: "string" - toolingVersion: - description: "The version of `toolingRepo` to bundle. Defaults to latest version." - required: false - default: "latest" - type: "string" - skipWindows: - description: "Whether to skip Windows builds, defaults to `false`" - required: false - default: false - type: "boolean" - skipLinux: - description: "Whether to skip Linux builds, defaults to `false`" - required: false - default: false - type: "boolean" - skipMacOS: - description: "Whether to skip macOS builds, defaults to `false`" - required: false - default: false - type: "boolean" - secrets: - token: - description: "GitHub token used to create the release and push assets to it." - required: true - outputs: - taggedVersion: - description: "The version that was tagged and pushed for the mod" - value: ${{ jobs.create_release.outputs.bundleTagName }} - -permissions: - contents: write - -jobs: - validate_metadata: - name: "Validate Metadata" - runs-on: ubuntu-latest - steps: - - name: "Checkout Workflow Scripts" - uses: actions/checkout@v4 - with: - repository: "open-goal/mod-bundling-tools" - ref: ${{ github.event.inputs.ref }} - path: "__actions/mod-bundling-tools" - - - name: "Create metadata.json" - env: - SCHEMA_VERSION: "0.1.0" - VERSION: "v0.0.0" - SUPPORTED_GAMES: ${{ inputs.metadataSupportedGames }} - OUT_DIR: "/tmp" - run: | - python ./__actions/mod-bundling-tools/scripts/create-mod-release/emit-metadata.py - - - name: "Validating Metadata" - run: | - npm install -g ajv-cli - ajv validate -s ./__actions/mod-bundling-tools/schemas/mods/v2/mod-schema.v2.json -d /tmp/metadata.json - - create_release: - name: "Create Release" - needs: - - validate_metadata - runs-on: ubuntu-latest - outputs: - bundleTagName: ${{ steps.tag_version.outputs.new_tag }} - steps: - - name: Bump Version and Push Tag - id: tag_version - uses: mathieudutour/github-tag-action@v6.1 - with: - github_token: ${{ secrets.token }} - tag_prefix: v - default_bump: ${{ inputs.semverBump }} - release_branches: ${{ inputs.releaseBranches }} - - - name: Create Release - env: - GITHUB_TOKEN: ${{ secrets.token }} - run: gh release create ${{ steps.tag_version.outputs.new_tag }} --generate-notes --draft --repo ${{ github.repository }} - - # if `buildBinaries`, run the workflow to build and generate artifacts - - build_windows_clang: - name: "Windows Build" - needs: create_release - if: ${{ !inputs.skipWindows && inputs.buildBinaries }} - # assumes that this file is defined in your mod repo - uses: ./.github/workflows/windows-build-clang.yaml - with: - cmakePreset: "Release-windows-clang-static" - cachePrefix: "static" - uploadArtifacts: true - secrets: inherit - - bundle_windows_build: - name: "Bundle Windows Build" - needs: - - create_release - - build_windows_clang - if: ${{ !inputs.skipWindows && inputs.buildBinaries }} - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - with: - ref: ${{ needs.create_release.outputs.bundleTagName }} - - - name: "Checkout Workflow Scripts" - uses: actions/checkout@v4 - with: - repository: "open-goal/mod-bundling-tools" - ref: ${{ github.event.inputs.ref }} - path: "__actions/mod-bundling-tools" - - - name: Prepare Artifact Folder - run: mkdir -p ./ci-artifacts - - - uses: actions/download-artifact@v4 - name: Download all Artifacts - with: - path: ./ci-artifacts/ - - - name: Display structure of downloaded files - run: ls -Rl ./ci-artifacts/ - - - name: Prepare Windows Build Assets - run: | - mkdir -p ./ci-artifacts/windows - mkdir -p ${{ inputs.outputDir }}/dist - chmod +x ./__actions/mod-bundling-tools/scripts/create-mod-release/releases/extract_build_windows.sh - ./__actions/mod-bundling-tools/scripts/create-mod-release/releases/extract_build_windows.sh ./ci-artifacts/windows ./ci-artifacts/opengoal-windows-static ./ - TAG_VAL=${{ needs.create_release.outputs.bundleTagName }} - 7z a -tzip ${{ inputs.outputDir }}/dist/windows-${TAG_VAL}.zip ./ci-artifacts/windows/* - - - name: Upload Bundle - uses: actions/upload-artifact@v4 - with: - name: windows - if-no-files-found: error - path: ${{ inputs.outputDir }}/dist - - build_linux_clang: - name: "Linux Build" - needs: create_release - if: ${{ !inputs.skipLinux && inputs.buildBinaries }} - # assumes that this file is defined in your mod repo - uses: ./.github/workflows/linux-build-clang.yaml - with: - cmakePreset: "Release-linux-clang-static" - cachePrefix: "static" - uploadArtifacts: true - secrets: inherit - - bundle_linux_build: - name: "Bundle Linux Build" - needs: - - create_release - - build_linux_clang - if: ${{ !inputs.skipLinux && inputs.buildBinaries }} - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - with: - ref: ${{ needs.create_release.outputs.bundleTagName }} - - - name: "Checkout Workflow Scripts" - uses: actions/checkout@v4 - with: - repository: "open-goal/mod-bundling-tools" - ref: ${{ github.event.inputs.ref }} - path: "__actions/mod-bundling-tools" - - - name: Prepare Artifact Folder - run: mkdir -p ./ci-artifacts - - - uses: actions/download-artifact@v4 - name: Download all Artifacts - with: - path: ./ci-artifacts/ - - - name: Display structure of downloaded files - run: ls -Rl ./ci-artifacts/ - - - name: Prepare Linux Build Assets - run: | - mkdir -p ./ci-artifacts/linux - mkdir -p ${{ inputs.outputDir }}/dist - chmod +x ./__actions/mod-bundling-tools/scripts/create-mod-release/releases/extract_build_unix.sh - ./__actions/mod-bundling-tools/scripts/create-mod-release/releases/extract_build_unix.sh ./ci-artifacts/linux ./ci-artifacts/opengoal-linux-static ./ - TAG_VAL=${{ needs.create_release.outputs.bundleTagName }} - tar czf ${{ inputs.outputDir }}/dist/linux-${TAG_VAL}.tar.gz ./ci-artifacts/linux - - - name: Upload Bundle - uses: actions/upload-artifact@v4 - with: - name: linux - if-no-files-found: error - path: ${{ inputs.outputDir }}/dist - - build_macos_intel: - name: "MacOS Build" - needs: create_release - if: ${{ !inputs.skipMacOS && inputs.buildBinaries }} - # assumes that this file is defined in your mod repo - uses: ./.github/workflows/macos-build.yaml - with: - cmakePreset: "Release-macos-clang-static" - cachePrefix: "static" - uploadArtifacts: true - secrets: inherit - - bundle_macos_build: - name: "Bundle MacOS Build" - needs: - - create_release - - build_macos_intel - if: ${{ !inputs.skipMacOS && inputs.buildBinaries }} - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - with: - ref: ${{ needs.create_release.outputs.bundleTagName }} - - - name: "Checkout Workflow Scripts" - uses: actions/checkout@v4 - with: - repository: "open-goal/mod-bundling-tools" - ref: ${{ github.event.inputs.ref }} - path: "__actions/mod-bundling-tools" - - - name: Prepare Artifact Folder - run: mkdir -p ./ci-artifacts - - - uses: actions/download-artifact@v4 - name: Download all Artifacts - with: - path: ./ci-artifacts/ - - - name: Display structure of downloaded files - run: ls -Rl ./ci-artifacts/ - - - name: Prepare MacOS Build Assets - run: | - mkdir -p ./ci-artifacts/macos-intel - mkdir -p ${{ inputs.outputDir }}/dist - chmod +x ./__actions/mod-bundling-tools/scripts/create-mod-release/releases/extract_build_unix.sh - ./__actions/mod-bundling-tools/scripts/create-mod-release/releases/extract_build_unix.sh ./ci-artifacts/macos-intel ./ci-artifacts/opengoal-macos-static ./ - TAG_VAL=${{ needs.create_release.outputs.bundleTagName }} - tar czf ${{ inputs.outputDir }}/dist/macos-intel-${TAG_VAL}.tar.gz ./ci-artifacts/macos-intel - - - name: Upload Bundle - uses: actions/upload-artifact@v4 - with: - name: macos-intel - if-no-files-found: error - path: ${{ inputs.outputDir }}/dist - - # if not `buildBinaries`, run the steps to build release assets - - bundle_windows_no_build: - name: "Bundle Windows (no build)" - needs: create_release - if: ${{ !inputs.skipWindows && !inputs.buildBinaries }} - runs-on: ubuntu-latest - steps: - - name: "Checkout Repository" - uses: actions/checkout@v4 - - - name: "Checkout Workflow Scripts" - uses: actions/checkout@v4 - with: - repository: "open-goal/mod-bundling-tools" - ref: ${{ github.event.inputs.ref }} - path: "__actions/mod-bundling-tools" - - - name: "Create Windows Release" - env: - outputDir: ${{ inputs.outputDir }} - versionName: ${{ needs.create_release.outputs.bundleTagName }} - toolingRepo: ${{ inputs.toolingRepo }} - toolingVersion: ${{ inputs.toolingVersion }} - run: python ./__actions/mod-bundling-tools/scripts/create-mod-release/bundle-windows.py - - - name: Upload Bundle - uses: actions/upload-artifact@v4 - with: - name: windows - if-no-files-found: error - path: ${{ inputs.outputDir }}/dist - - bundle_linux_no_build: - name: "Bundle Linux (no build)" - needs: create_release - if: ${{ !inputs.skipLinux && !inputs.buildBinaries }} - runs-on: ubuntu-latest - steps: - - name: "Checkout Repository" - uses: actions/checkout@v4 - - - name: "Checkout Workflow Scripts" - uses: actions/checkout@v4 - with: - repository: "open-goal/mod-bundling-tools" - ref: ${{ github.event.inputs.ref }} - path: "__actions/mod-bundling-tools" - - - name: "Create Linux Release" - env: - outputDir: ${{ inputs.outputDir }} - versionName: ${{ needs.create_release.outputs.bundleTagName }} - toolingRepo: ${{ inputs.toolingRepo }} - toolingVersion: ${{ inputs.toolingVersion }} - run: python ./__actions/mod-bundling-tools/scripts/create-mod-release/bundle-linux.py - - - name: Upload Bundle - uses: actions/upload-artifact@v4 - with: - name: linux - if-no-files-found: error - path: ${{ inputs.outputDir }}/dist - - bundle_macos_no_build: - name: "Bundle macOS Intel (no build)" - needs: create_release - if: ${{ !inputs.skipMacOS && !inputs.buildBinaries }} - runs-on: ubuntu-latest - steps: - - name: "Checkout Repository" - uses: actions/checkout@v4 - - - name: "Checkout Workflow Scripts" - uses: actions/checkout@v4 - with: - repository: "open-goal/mod-bundling-tools" - ref: ${{ github.event.inputs.ref }} - path: "__actions/mod-bundling-tools" - - - name: "Create MacOS Intel Release" - env: - outputDir: ${{ inputs.outputDir }} - versionName: ${{ needs.create_release.outputs.bundleTagName }} - toolingRepo: ${{ inputs.toolingRepo }} - toolingVersion: ${{ inputs.toolingVersion }} - run: python ./__actions/mod-bundling-tools/scripts/create-mod-release/bundle-macos.py - - - name: Upload Bundle - uses: actions/upload-artifact@v4 - with: - name: macos-intel - if-no-files-found: error - path: ${{ inputs.outputDir }}/dist - - finalize_release: - name: "Finalize Release" - needs: - - create_release - - bundle_windows_build - - bundle_linux_build - - bundle_macos_build - - bundle_windows_no_build - - bundle_linux_no_build - - bundle_macos_no_build - if: | - always() && - needs.create_release.result == 'success' && - (needs.bundle_windows_build.result == 'skipped' || needs.bundle_windows_build.result == 'success') && - (needs.bundle_linux_build.result == 'skipped' || needs.bundle_linux_build.result == 'success') && - (needs.bundle_macos_build.result == 'skipped' || needs.bundle_macos_build.result == 'success') && - (needs.bundle_windows_no_build.result == 'skipped' || needs.bundle_windows_no_build.result == 'success') && - (needs.bundle_linux_no_build.result == 'skipped' || needs.bundle_linux_no_build.result == 'success') && - (needs.bundle_macos_no_build.result == 'skipped' || needs.bundle_macos_no_build.result == 'success') - runs-on: ubuntu-latest - steps: - - name: "Checkout Workflow Scripts" - uses: actions/checkout@v4 - with: - repository: "open-goal/mod-bundling-tools" - ref: ${{ github.event.inputs.ref }} - path: "__actions/mod-bundling-tools" - - - name: Prepare Output Folder - run: mkdir -p ${{ inputs.outputDir }}/dist - - - name: Download all Artifacts - uses: actions/download-artifact@v4 - with: - path: ${{ inputs.outputDir }}/artifacts - - - name: Display structure of downloaded files - run: ls -Rl ${{ inputs.outputDir }} - - - name: Move Linux Assets - if: ${{ !inputs.skipLinux }} - run: mv ${{ inputs.outputDir }}/artifacts/linux/* ${{ inputs.outputDir }}/dist - - - name: Move Windows Assets - if: ${{ !inputs.skipWindows }} - run: mv ${{ inputs.outputDir }}/artifacts/windows/* ${{ inputs.outputDir }}/dist - - - name: Move MacOS Assets - if: ${{ !inputs.skipMacOS }} - run: mv ${{ inputs.outputDir }}/artifacts/macos-intel/* ${{ inputs.outputDir }}/dist - - - name: Prepare Release Metadata - env: - SCHEMA_VERSION: "0.1.0" - VERSION: ${{ needs.create_release.outputs.bundleTagName }} - SUPPORTED_GAMES: ${{ inputs.metadataSupportedGames }} - OUT_DIR: "${{ inputs.outputDir }}/dist" - run: python ./__actions/mod-bundling-tools/scripts/create-mod-release/emit-metadata.py - - - name: Validating Metadata - run: | - npm install -g ajv-cli - ajv validate -s ./__actions/mod-bundling-tools/schemas/mods/v2/mod-schema.v2.json -d ${{ inputs.outputDir }}/dist/metadata.json - - - name: Upload Assets - env: - GITHUB_TOKEN: ${{ secrets.token }} - run: | - TAG_VAL=${{ needs.create_release.outputs.bundleTagName }} - echo $TAG_VAL - gh release upload "${TAG_VAL}" ${{ github.WORKSPACE }}/${{ inputs.outputDir }}/dist/* --repo ${{ github.repository }} --clobber - - - name: Publish Release - env: - GITHUB_TOKEN: ${{ secrets.token }} - run: | - TAG_VAL=${{ needs.create_release.outputs.bundleTagName }} - echo $TAG_VAL - gh release edit ${TAG_VAL} --draft=false --repo ${{ github.repository }} diff --git a/schemas/mods/v2/mod-schema.v2.json b/schemas/mods/v2/mod-schema.v2.json deleted file mode 100644 index dfa1f90..0000000 --- a/schemas/mods/v2/mod-schema.v2.json +++ /dev/null @@ -1,43 +0,0 @@ -{ - "$ref": "#/definitions/ModMetadata", - "$schema": "http://json-schema.org/draft-07/schema#", - "definitions": { - "ModMetadata": { - "additionalProperties": false, - "properties": { - "publishedDate": { - "type": "string" - }, - "schemaVersion": { - "description": "Semantic Version", - "pattern": "^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?$", - "type": "string" - }, - "supportedGames": { - "items": { - "enum": [ - "jak1", - "jak2", - "jak3", - "jakx" - ], - "type": "string" - }, - "type": "array" - }, - "version": { - "description": "Semantic Version", - "pattern": "^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?$", - "type": "string" - } - }, - "required": [ - "schemaVersion", - "version", - "publishedDate", - "supportedGames" - ], - "type": "object" - } - } -} diff --git a/schemas/mods/v2/types.ts b/schemas/mods/v2/types.ts deleted file mode 100644 index aef931e..0000000 --- a/schemas/mods/v2/types.ts +++ /dev/null @@ -1,21 +0,0 @@ -// interface ChangelogEntry { -// summary: string, -// timestamp: string, -// authors?: string[], -// description?: string, -// } - -/** - * Semantic Version - * @pattern ^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$ - */ -type Semver = string; - -type SupportedGame = "jak1" | "jak2" | "jak3" | "jakx"; - -export interface ModMetadata { - schemaVersion: Semver; - version: Semver; - publishedDate: string; - supportedGames: SupportedGame[]; -} diff --git a/scripts/create-mod-release/bundle-linux.py b/scripts/create-mod-release/bundle-linux.py deleted file mode 100644 index ae458e8..0000000 --- a/scripts/create-mod-release/bundle-linux.py +++ /dev/null @@ -1,27 +0,0 @@ -from common import ( - create_output_dir, - download_release, - finalize_bundle, - get_args, - override_binaries_and_assets, - patch_mod_timestamp_and_version_info, -) - -args = get_args("linux") - -print(args) - -# Create our output directory -create_output_dir(args, "linux") - -# Download the Release -download_release(args, "linux", is_zip=False) - -# Override any files -override_binaries_and_assets(args, "linux") - -# Replace placeholder text with mod version and timestamp -patch_mod_timestamp_and_version_info(args, "linux") - -# Rezip it up and prepare it for upload -finalize_bundle(args, "linux", is_zip=False) diff --git a/scripts/create-mod-release/bundle-macos.py b/scripts/create-mod-release/bundle-macos.py deleted file mode 100644 index 07dc327..0000000 --- a/scripts/create-mod-release/bundle-macos.py +++ /dev/null @@ -1,27 +0,0 @@ -from common import ( - create_output_dir, - download_release, - finalize_bundle, - get_args, - override_binaries_and_assets, - patch_mod_timestamp_and_version_info, -) - -args = get_args("macos-intel") - -print(args) - -# Create our output directory -create_output_dir(args, "macos-intel") - -# Download the Release -download_release(args, "macos-intel", is_zip=False) - -# Override any files -override_binaries_and_assets(args, "macos-intel") - -# Replace placeholder text with mod version and timestamp -patch_mod_timestamp_and_version_info(args, "macos-intel") - -# Rezip it up and prepare it for upload -finalize_bundle(args, "macos-intel", is_zip=False) diff --git a/scripts/create-mod-release/bundle-windows.py b/scripts/create-mod-release/bundle-windows.py deleted file mode 100644 index 38df6da..0000000 --- a/scripts/create-mod-release/bundle-windows.py +++ /dev/null @@ -1,27 +0,0 @@ -from common import ( - create_output_dir, - download_release, - finalize_bundle, - get_args, - override_binaries_and_assets, - patch_mod_timestamp_and_version_info, -) - -args = get_args("windows") - -print(args) - -# Create our output directory -create_output_dir(args, "windows") - -# Download or Build the Release -download_release(args, "windows", is_zip=True) - -# Override any files -override_binaries_and_assets(args, "windows") - -# Replace placeholder text with mod version and timestamp -patch_mod_timestamp_and_version_info(args, "windows") - -# Rezip it up and prepare it for upload -finalize_bundle(args, "windows", is_zip=True) diff --git a/scripts/create-mod-release/common.py b/scripts/create-mod-release/common.py deleted file mode 100644 index e8eefa3..0000000 --- a/scripts/create-mod-release/common.py +++ /dev/null @@ -1,191 +0,0 @@ -import datetime -import json -import os -import glob -import shutil -import tarfile -import urllib.request -import zipfile - - -def default_asset_prefix(platform): - if platform == "windows": - return "opengoal-windows" - elif platform == "linux": - return "opengoal-linux" - elif platform == "macos-intel": - return "opengoal-macos-intel" - elif platform == "macos-arm": - return "opengoal-macos-arm" - else: - return "opengoal-unknown" - - -def get_args(platform): - return { - "outputDir": os.getenv("outputDir"), - "versionName": os.getenv("versionName"), - "toolingRepo": os.getenv("toolingRepo"), - "toolingReleaseAssetPrefix": os.getenv( - "toolingReleaseAssetPrefix", default_asset_prefix(platform) - ), - "toolingVersion": os.getenv("toolingVersion") - } - - -def create_output_dir(args, dir_name): - if os.path.exists(os.path.join(args["outputDir"], dir_name)): - print( - "Expected output directory already exists, clearing it - {}".format( - os.path.join(args["outputDir"], dir_name) - ) - ) - os.rmdir(os.path.join(args["outputDir"], dir_name)) - - os.makedirs(os.path.join(args["outputDir"], dir_name), exist_ok=True) - -def download_release(args, out_folder, is_zip=True): - toolingRepo = args["toolingRepo"] - tooling_version = args["toolingVersion"] - if tooling_version == "latest": - # Get the latest release - with urllib.request.urlopen( - f"https://api.github.com/repos/{toolingRepo}/releases/latest" - ) as response: - data = json.loads(response.read().decode()) - tooling_version = data["tag_name"] - - if is_zip: - releaseAssetUrl = f"https://github.com/{toolingRepo}/releases/download/{tooling_version}/{args['toolingReleaseAssetPrefix']}-{tooling_version}.zip" - urllib.request.urlretrieve( - releaseAssetUrl, os.path.join(args["outputDir"], out_folder, "release.zip") - ) - # Extract it - with zipfile.ZipFile( - os.path.join(args["outputDir"], out_folder, "release.zip"), "r" - ) as zip_ref: - zip_ref.extractall(os.path.join(args["outputDir"], out_folder)) - os.remove(os.path.join(args["outputDir"], out_folder, "release.zip")) - else: - releaseAssetUrl = f"https://github.com/{toolingRepo}/releases/download/{tooling_version}/{args['toolingReleaseAssetPrefix']}-{tooling_version}.tar.gz" - urllib.request.urlretrieve( - releaseAssetUrl, - os.path.join(args["outputDir"], out_folder, "release.tar.gz"), - ) - # Extract it - with tarfile.open( - os.path.join(args["outputDir"], out_folder, "release.tar.gz") - ) as tar_ball: - tar_ball.extractall(os.path.join(args["outputDir"], out_folder)) - os.remove(os.path.join(args["outputDir"], out_folder, "release.tar.gz")) - - -def override_binaries_and_assets(args, out_folder): - # Copy-in Mod Assets - customAssetsDir = "./custom_assets" - if os.path.exists(customAssetsDir): - shutil.copytree( - customAssetsDir, - os.path.join(args["outputDir"], out_folder, "data", "custom_assets"), - dirs_exist_ok=True, - ) - - goalSourceDir = "./goal_src" - if not os.path.exists(goalSourceDir): - print( - "Goal source directory not found at {}, not much of a mod without that!".format( - goalSourceDir - ) - ) - exit(1) - shutil.copytree( - goalSourceDir, - os.path.join(args["outputDir"], out_folder, "data", "goal_src"), - dirs_exist_ok=True, - ) - - gameAssetsDir = "./game/assets" - if not os.path.exists(gameAssetsDir): - print("Game assets directory not found at {}!".format(gameAssetsDir)) - exit(1) - shutil.copytree( - gameAssetsDir, - os.path.join(args["outputDir"], out_folder, "data", "game", "assets"), - dirs_exist_ok=True, - ) - - decompilerConfigDir = "./decompiler/config" - if os.path.exists(decompilerConfigDir): - shutil.copytree( - decompilerConfigDir, - os.path.join(args["outputDir"], out_folder, "data", "decompiler", "config"), - dirs_exist_ok=True, - ) - else: - print( - "Decompiler config directory not found at {}, skipping.".format( - decompilerConfigDir - ) - ) - - -def patch_mod_timestamp_and_version_info(args, out_folder): - try: - mod_settings_files = glob.glob(f"{args['outputDir']}/{out_folder}/data/goal_src/**/mod-settings.gc", recursive=True) - for settings_file_path in mod_settings_files: - file = open(settings_file_path, "r") - file_data = file.read() - file.close() - # Check if the placeholder string is present in the file - if "%MODVERSIONPLACEHOLDER%" in file_data: - # Replace the placeholder string with the version and date string - version_str = ( - args["versionName"] - + " " - + datetime.datetime.now(datetime.timezone.utc).strftime("%Y-%m-%d %H:%M:%S") - ) - file_data = file_data.replace("%MODVERSIONPLACEHOLDER%", version_str) - # Write the updated content back to the mod-settings - file = open(settings_file_path, "w") - file.write(file_data) - file.close() - print( - f"String %MODVERSIONPLACEHOLDER% replaced with '{version_str}' in the file." - ) - else: - print(f"Couldn't find %MODVERSIONPLACEHOLDER% in the file.") - except Exception as e: - print( - f"Something went wrong trying to replace placeholder text with mod version info:" - ) - print(e) - -def finalize_bundle(args, out_folder, is_zip=True): - if is_zip: - shutil.make_archive( - f"{out_folder}-{args['versionName']}", - "zip", - os.path.join(args["outputDir"], out_folder), - ) - os.makedirs(os.path.join(args["outputDir"], "dist"), exist_ok=True) - shutil.move( - f"{out_folder}-{args['versionName']}.zip", - os.path.join( - args["outputDir"], "dist", f"{out_folder}-{args['versionName']}.zip" - ), - ) - else: - shutil.make_archive( - f"{out_folder}-{args['versionName']}", - "gztar", - os.path.join(args["outputDir"], out_folder), - ) - os.makedirs(os.path.join(args["outputDir"], "dist"), exist_ok=True) - shutil.move( - f"{out_folder}-{args['versionName']}.tar.gz", - os.path.join( - args["outputDir"], "dist", f"{out_folder}-{args['versionName']}.tar.gz" - ), - ) - # Cleanup - shutil.rmtree(os.path.join(args["outputDir"], out_folder)) diff --git a/scripts/create-mod-release/emit-metadata.py b/scripts/create-mod-release/emit-metadata.py deleted file mode 100644 index 2acbd96..0000000 --- a/scripts/create-mod-release/emit-metadata.py +++ /dev/null @@ -1,36 +0,0 @@ -# Simple script to emit a metadata.json file with the relevant mod information -# Values are passed in as environment variables -from datetime import datetime -import json -import os - -def split_comma_sep_val(str): - if "," not in str: - return [str] - return str.split(",") - -# Validate supported games list -games = split_comma_sep_val(os.getenv("SUPPORTED_GAMES")) -if len(games) == 0: - print("SUPPORTED_GAMES list is empty") - exit(1) -for game in games: - if game != "jak1" and game != "jak2" and game != "jak3" and game != "jakx": - print("SUPPORTED_GAMES contains invalid game: ", game) - exit(1) - -# Input has been validated, create metadata.json -metadata = { - "schemaVersion": os.getenv("SCHEMA_VERSION"), - "version": os.getenv("VERSION").removeprefix("v"), - "supportedGames": games, - "publishedDate": datetime.now().isoformat(), -} - -with open("{}/metadata.json".format(os.getenv("OUT_DIR")), "w", encoding="utf-8") as f: - print( - "Writing the following metadata: {}".format( - json.dumps(metadata, indent=2, ensure_ascii=False) - ) - ) - f.write(json.dumps(metadata, indent=2, ensure_ascii=False)) diff --git a/scripts/create-mod-release/releases/error-code-metadata.json b/scripts/create-mod-release/releases/error-code-metadata.json deleted file mode 100644 index 95a0cf1..0000000 --- a/scripts/create-mod-release/releases/error-code-metadata.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "4000": { - "msg": "Validation Failed: Cannot locate ELF" - }, - "4001": { - "msg": "Validation Failed: Game serial missing from valid game database" - }, - "4002": { - "msg": "Validation Failed: ELF missing from valid game database" - }, - "4010": { - "msg": "Validation Failed: Bad or unexpected ISO contents" - }, - "4011": { - "msg": "Validation Failed: Extracted an unexpected amount of files from ISO" - }, - "4020": { - "msg": "Validation Failed: ISO Extraction failed, output directory did not contain expected files" - }, - "4030": { - "msg": "Decompilation Failed: An error occurred" - }, - "4040": { - "msg": "Extraction Failed: Provided game data file was not an ISO file" - }, - "4041": { - "msg": "Extraction Failed: Provided game data file was corrupt or has unexpected size" - } -} diff --git a/scripts/create-mod-release/releases/extract_build_unix.sh b/scripts/create-mod-release/releases/extract_build_unix.sh deleted file mode 100644 index 1c91f85..0000000 --- a/scripts/create-mod-release/releases/extract_build_unix.sh +++ /dev/null @@ -1,35 +0,0 @@ -#!/usr/bin/env bash - -set -e - -DEST=${1} -BIN_SOURCE=${2} -SOURCE=${3} - -mkdir -p $DEST - -PREP_BIN="${PREP_BIN:-true}" - -if [ "$PREP_BIN" = "true" ]; then - cp $BIN_SOURCE/game/gk $DEST - cp $BIN_SOURCE/goalc/goalc $DEST - cp $BIN_SOURCE/decompiler/extractor $DEST - - chmod +x $DEST/gk - chmod +x $DEST/goalc - chmod +x $DEST/extractor -fi - -mkdir -p $DEST/data -mkdir -p $DEST/data/launcher/ -mkdir -p $DEST/data/decompiler/ -mkdir -p $DEST/data/game -mkdir -p $DEST/data/log -mkdir -p $DEST/data/game/graphics/opengl_renderer/ - -cp -r $SOURCE/.github/scripts/releases/error-code-metadata.json $DEST/data/launcher/error-code-metadata.json -cp -r $SOURCE/decompiler/config $DEST/data/decompiler/ -cp -r $SOURCE/goal_src $DEST/data -cp -r $SOURCE/game/assets $DEST/data/game/ -cp -r $SOURCE/game/graphics/opengl_renderer/shaders $DEST/data/game/graphics/opengl_renderer -cp -r $SOURCE/custom_assets $DEST/data diff --git a/scripts/create-mod-release/releases/extract_build_windows.sh b/scripts/create-mod-release/releases/extract_build_windows.sh deleted file mode 100644 index 36c8ee8..0000000 --- a/scripts/create-mod-release/releases/extract_build_windows.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/usr/bin/env bash - -set -e - -DEST=${1} -BIN_SOURCE=${2} -SOURCE=${3} - -mkdir -p $DEST - -cp $BIN_SOURCE/gk.exe $DEST -cp $BIN_SOURCE/goalc.exe $DEST -cp $BIN_SOURCE/extractor.exe $DEST - -mkdir -p $DEST/data -mkdir -p $DEST/data/launcher/ -mkdir -p $DEST/data/decompiler/ -mkdir -p $DEST/data/game -mkdir -p $DEST/data/log -mkdir -p $DEST/data/game/graphics/opengl_renderer/ - -cp -r $SOURCE/.github/scripts/releases/error-code-metadata.json $DEST/data/launcher/error-code-metadata.json -cp -r $SOURCE/decompiler/config $DEST/data/decompiler/ -cp -r $SOURCE/goal_src $DEST/data -cp -r $SOURCE/game/assets $DEST/data/game/ -cp -r $SOURCE/game/graphics/opengl_renderer/shaders $DEST/data/game/graphics/opengl_renderer -cp -r $SOURCE/custom_assets $DEST/data