From e3fdb8eddd37c0d70ecfc8ce2ad4874ee2598ad6 Mon Sep 17 00:00:00 2001 From: LUCASTUCIOUS Date: Mon, 29 Jul 2024 11:58:06 +0200 Subject: [PATCH] workflow --- .forgejo/actions/build-godot.yaml | 35 ++++++++++++++++++++++++++ .forgejo/actions/entrypoint.sh | 39 +++++++++++++++++++++++++++++ .forgejo/workflows/build.yaml | 41 +++++++++++++++++++++++++++++++ 3 files changed, 115 insertions(+) create mode 100644 .forgejo/actions/build-godot.yaml create mode 100644 .forgejo/actions/entrypoint.sh create mode 100644 .forgejo/workflows/build.yaml diff --git a/.forgejo/actions/build-godot.yaml b/.forgejo/actions/build-godot.yaml new file mode 100644 index 0000000..1339bd0 --- /dev/null +++ b/.forgejo/actions/build-godot.yaml @@ -0,0 +1,35 @@ +name: "Build Godot" +description: "Build a Godot project for multiple platforms" +author: josephbmanley +inputs: + name: + description: 'Name of the exported binary' + required: true + preset: + description: 'Name of the preset in `export_presets.cfg` to use' + required: true + subdirectory: + description: 'Optional name of the subdirectory to put exported project in' + default: "" + package: + description: 'Set true to output an artifact zip file' + default: false + projectDir: + description: 'Location of Godot project in repository' + default: "." + debugMode: + description: 'Whether or not to use `--export-debug`' + default: false +runs: + using: docker + image: Dockerfile + args: + - ${{ inputs.name }} + - ${{ inputs.preset }} + - ${{ inputs.subdirectory }} + - ${{ inputs.package }} + - ${{ inputs.projectDir }} + - ${{ inputs.debugMode }} +branding: + icon: loader + color: blue \ No newline at end of file diff --git a/.forgejo/actions/entrypoint.sh b/.forgejo/actions/entrypoint.sh new file mode 100644 index 0000000..daba9ca --- /dev/null +++ b/.forgejo/actions/entrypoint.sh @@ -0,0 +1,39 @@ +#!/bin/sh +set -e + +# Move godot templates already installed from the docker image to home +mkdir -v -p ~/.local/share/godot/export_templates +cp -a /root/.local/share/godot/export_templates/. ~/.local/share/godot/export_templates/ + + +if [ "$3" != "" ] +then + SubDirectoryLocation="$3/" +fi + +mode="export-release" +if [ "$6" = "true" ] +then + echo "Exporting in debug mode!" + mode="export-debug" +fi + +# Export for project +echo "Building $1 for $2" +mkdir -p $GITHUB_WORKSPACE/build/${SubDirectoryLocation:-""} +cd "$GITHUB_WORKSPACE/$5" +godot --headless --${mode} "$2" $GITHUB_WORKSPACE/build/${SubDirectoryLocation:-""}$1 +echo "Build Done" + +echo ::set-output name=build::build/${SubDirectoryLocation:-""} + + +if [ "$4" = "true" ] +then + echo "Packing Build" + mkdir -p $GITHUB_WORKSPACE/package + cd $GITHUB_WORKSPACE/build + zip $GITHUB_WORKSPACE/package/artifact.zip ${SubDirectoryLocation:-"."} -r + echo ::set-output name=artifact::package/artifact.zip + echo "Done" +fi \ No newline at end of file diff --git a/.forgejo/workflows/build.yaml b/.forgejo/workflows/build.yaml new file mode 100644 index 0000000..c22ba05 --- /dev/null +++ b/.forgejo/workflows/build.yaml @@ -0,0 +1,41 @@ +on: + push: + tags: + - "v*" +jobs: + # job id, can be anything + export_game: + # Always use ubuntu-latest for this action + runs-on: linux_amd64 + # Add permission for release creation. Can be made narrower according to your needs + permissions: write-all + # Job name, can be anything + name: Export Game + steps: + # Always include the checkout step so that + # your project is available for Godot to export + - name: checkout + uses: actions/checkout@v3.3.0 + lfs: true + + - name: export game + id: export + # Use latest version (see releases for all versions) + uses: https://github.com/lucastucious/godot-export@v5.3 + with: + # Defining all the required inputs + godot_executable_download_url: https://github.com/godotengine/godot/releases/download/4.2.2-stable/Godot_v4.2.2-stable_linux.x86_64.zip + godot_export_templates_download_url: https://github.com/godotengine/godot/releases/download/4.2.2-stable/Godot_v4.2.2-stable_export_templates.tpz + relative_project_path: ./ + archive_output: true + cache: true + + # This release action has worked well for me. However, you can most likely use any release action of your choosing. + # https://github.com/ncipollo/release-action + - name: create release + uses: https://code.forgejo.org/actions/forgejo-release@v2.2.0 + with: + direction: upload + release-dir: ${{ steps.export.outputs.archive_directory }} + token: ${{ env.GITHUB_TOKEN }} + release-notes: "New build" \ No newline at end of file