builds godot
manual build workflow
| -rw-r--r-- | .github/actions/build-godot/action.yml | 29 | ||||
| -rw-r--r-- | .github/actions/build-upload-image/action.yml | 48 | ||||
| -rw-r--r-- | .github/actions/get-version/action.yml | 33 | ||||
| -rw-r--r-- | .github/actions/setup/action.yml | 21 | ||||
| -rw-r--r-- | .github/workflows/build-3.x.yml | 16 | ||||
| -rw-r--r-- | .github/workflows/manual-build.yml | 27 | ||||
| -rw-r--r-- | .github/workflows/reusable-build.yml (renamed from .github/workflows/builds.yml) | 56 |
7 files changed, 170 insertions, 60 deletions
diff --git a/.github/actions/build-godot/action.yml b/.github/actions/build-godot/action.yml index 254d174..5c14547 100644 --- a/.github/actions/build-godot/action.yml +++ b/.github/actions/build-godot/action.yml @@ -19,13 +19,10 @@ inputs: runs: using: "composite" steps: - - name: Checkout - run: | - [[ -d godot ]] && exit 0 # already checked out - git clone --depth 1 "${{ inputs.url }}" -b "${{ env.branch }}" godot - cd godot - curl 'https://raw.githubusercontent.com/bend-n/godot-2d-builds/main/.github/custom.py' --output custom.py || wget -nv 'https://raw.githubusercontent.com/bend-n/godot-2d-builds/main/.github/custom.py' -O custom.py - shell: bash + - name: Setup + uses: bend-n/godot-2d-builds/.github/actions/setup@main + with: + branch: ${{ env.branch }} - name: Install linux dependencies if: ${{ inputs.platform }} == "x11" @@ -35,20 +32,18 @@ runs: sudo apt-get install -qqq \ build-essential pkg-config libx11-dev libxcursor-dev \ libxinerama-dev libgl1-mesa-dev libglu-dev libasound2-dev \ - libpulse-dev libudev-dev libxi-dev libxrandr-dev yasm tree + libpulse-dev libudev-dev libxi-dev libxrandr-dev yasm \ + libspeechd-dev speech-dispatcher \ + tree shell: bash - name: Setup Python uses: actions/setup-python@v2 with: - python-version: "3.9.1" + python-version: 3.9 - - name: Setup SCons - run: | - python -c "import sys; print(sys.version)" - python -m pip install scons - python --version - scons --version + - name: Setup scons + run: pip install scons shell: bash - name: Build Godot @@ -57,9 +52,7 @@ runs: scons_flags=$flags cores=$(nproc) || cores=$(sysctl -n hw.ncpu) [[ -n "${{ inputs.flags }}" ]] && scons_flags="${{ inputs.flags }}" - command="scons -j$((cores+2)) p=${{ inputs.platform }} tools=$tools target=${{ inputs.target }} use_lto=yes udev=yes $scons_flags" - echo "running scons: $command" - $command + scons -j$((cores+2)) p=${{ inputs.platform }} tools=$tools target=${{ inputs.target }} use_lto=yes udev=yes $scons_flags strip bin/* || true ls bin shell: bash diff --git a/.github/actions/build-upload-image/action.yml b/.github/actions/build-upload-image/action.yml new file mode 100644 index 0000000..651f99c --- /dev/null +++ b/.github/actions/build-upload-image/action.yml @@ -0,0 +1,48 @@ +name: Build upload docker image +description: Build and upload docker image to ghcr.io + +inputs: + github-token: + required: true + description: GitHub token + +runs: + using: "composite" + steps: + - uses: actions/checkout@v3 + + - name: Get version + uses: bend-n/godot-2d-builds/.github/actions/get-version@main + + - name: Get templates + uses: actions/download-artifact@v3 + with: + name: templates + + - name: Get headless + uses: actions/download-artifact@v3 + with: + name: server-tools-release + + - run: mv godot_server.x11.opt.tools.64 godot && chmod -v +x godot + shell: bash + + - name: Login to GitHub Container Registry + uses: docker/[email protected] + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ inputs.github-token }} + + - name: Build and push Docker image + uses: docker/build-push-action@v3 + with: + context: . + file: Dockerfile + push: true + tags: ghcr.io/${{ github.repository_owner }}/godot-2d:${{ env.version-name }}${{ env.tag }} + build-args: | + GODOT_VERSION=${{ env.version-name }} + RELEASE_NAME=${{ env.release }} + env: + tag: ${{ env.release != 'stable' && format('.{0}', env.release) || '' }} diff --git a/.github/actions/get-version/action.yml b/.github/actions/get-version/action.yml new file mode 100644 index 0000000..c29c6c2 --- /dev/null +++ b/.github/actions/get-version/action.yml @@ -0,0 +1,33 @@ +name: Get version of a branch +description: Get version of a branch from version.py + +runs: + using: "composite" + steps: + - name: Setup + uses: bend-n/godot-2d-builds/.github/actions/setup@main + with: + branch: ${{ env.branch }} + + - name: Setup Python + uses: actions/setup-python@v2 + + - name: Get version of branch + run: | + cd godot + echo 'print(f"{major}.{minor}")' >> version.py + echo "version-name=$(python version.py)" >> $GITHUB_ENV + version=$(python version.py) + + git checkout version.py + + echo 'print(status)' >> version.py + echo "release=$(python version.py)" >> $GITHUB_ENV + release=$(python version.py) + echo "#### ${version}.${release} :rocket:" >> $GITHUB_STEP_SUMMARY + shell: bash + + - name: Post get version + if: always() + run: rm -rf godot + shell: bash diff --git a/.github/actions/setup/action.yml b/.github/actions/setup/action.yml new file mode 100644 index 0000000..e39331f --- /dev/null +++ b/.github/actions/setup/action.yml @@ -0,0 +1,21 @@ +name: "Setup" +description: "Setup the environment for building" + +inputs: + url: + description: Godot git url + default: https://github.com/godotengine/godot + required: true + branch: + description: Which branch to build + required: true + +runs: + using: "composite" + steps: + - name: Checkout + run: | + [[ -d godot ]] && exit 0 # already checked out + git clone --depth 1 "${{ inputs.url }}" -b "${{ inputs.branch }}" godot + curl 'https://raw.githubusercontent.com/bend-n/godot-2d-builds/main/.github/custom.py' --output godot/custom.py || wget -nv 'https://raw.githubusercontent.com/bend-n/godot-2d-builds/main/.github/custom.py' -O godot/custom.py + shell: bash diff --git a/.github/workflows/build-3.x.yml b/.github/workflows/build-3.x.yml new file mode 100644 index 0000000..2fdaf04 --- /dev/null +++ b/.github/workflows/build-3.x.yml @@ -0,0 +1,16 @@ +name: Build godot 2d on branch 3.x + +on: + workflow_dispatch: + push: + branches: + - main + pull_request: + +jobs: + build-3x: + name: Build 3.x + uses: bend-n/godot-2d-builds/.github/workflows/reusable-build.yml@main + with: + branch: 3.x + secrets: inherit diff --git a/.github/workflows/manual-build.yml b/.github/workflows/manual-build.yml new file mode 100644 index 0000000..bd96fb2 --- /dev/null +++ b/.github/workflows/manual-build.yml @@ -0,0 +1,27 @@ +name: Manually build godot 2d + +on: + workflow_dispatch: + inputs: + branch: + type: choice + description: which branch to build + required: true + options: + - "2.0" + - "2.1" + - "3.0" + - "3.1" + - "3.2" + - "3.3" + - "3.4" + - "3.5" + - "3.x" + +jobs: + manual-build: + name: Build ${{ inputs.branch }} + uses: bend-n/godot-2d-builds/.github/workflows/reusable-build.yml@main + with: + branch: ${{ inputs.branch }} + secrets: inherit diff --git a/.github/workflows/builds.yml b/.github/workflows/reusable-build.yml index 7ffc0a1..2f9e5cb 100644 --- a/.github/workflows/builds.yml +++ b/.github/workflows/reusable-build.yml @@ -1,18 +1,20 @@ -name: Build godot 2d +name: Reusable build workflow on: - workflow_dispatch: - push: - branches: - - main - pull_request: + workflow_call: + inputs: + branch: + required: true + type: string + flags: + type: string + default: disable_3d=yes + required: false env: - version-name: 3.5 - release: rc - branch: 3.x + branch: ${{ inputs.branch }} + flags: ${{ inputs.flags }} tools: no - flags: disable_3d=yes jobs: linux: @@ -230,36 +232,6 @@ jobs: runs-on: ubuntu-latest needs: [tools, templates] steps: - - uses: actions/checkout@v3 - - - name: Get templates - uses: actions/download-artifact@v3 - with: - name: templates - - - name: Get headless - uses: actions/download-artifact@v3 + - uses: bend-n/godot-2d-builds/.github/actions/build-upload-image@main with: - name: server-tools-release - - - run: mv godot_server.x11.opt.tools.64 godot && chmod +x godot - - - name: Login to GitHub Container Registry - uses: docker/[email protected] - with: - registry: ghcr.io - username: ${{ github.repository_owner }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Build and push Docker image - uses: docker/build-push-action@v3 - with: - context: . - file: Dockerfile - push: true - tags: ghcr.io/${{ github.repository_owner }}/godot-2d:${{ env.version-name }}${{ env.tag }} - build-args: | - GODOT_VERSION=${{ env.version-name }} - RELEASE_NAME=${{ env.release }} - env: - tag: ${{ env.release != 'stable' && format('.{0}', env.release) || '' }} + github-token: ${{ secrets.GITHUB_TOKEN }} |