From 651e66176ab66ba920d9487614fd472f470612a8 Mon Sep 17 00:00:00 2001 From: Adriano Orioli Date: Tue, 7 Jun 2022 19:32:51 +0200 Subject: [PATCH] Add a Manual Build workflow (#83) --- .github/workflows/manual_build.yml | 79 ++++++++++++++++++++++++++++++ .github/workflows/release.yml | 1 + Dockerfile | 21 ++++---- mono.Dockerfile | 2 +- 4 files changed, 93 insertions(+), 10 deletions(-) create mode 100644 .github/workflows/manual_build.yml diff --git a/.github/workflows/manual_build.yml b/.github/workflows/manual_build.yml new file mode 100644 index 0000000..764e773 --- /dev/null +++ b/.github/workflows/manual_build.yml @@ -0,0 +1,79 @@ +name: Manual Build +on: + workflow_dispatch: + inputs: + version: + description: 'Version of engine to build e.g. "3.4.4", "3.5"' + required: true + type: string + release_name: + description: 'Release name, usually "stable", but can also be something like "rc3", "beta1"' + type: string + default: "stable" + required: true +env: + IMAGE_NAME: godot-ci +jobs: + build: + name: Build Image + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v3 + - run: echo IMAGE_OWNER=$(echo ${{ github.repository_owner }} | tr '[:upper:]' '[:lower:]') >> $GITHUB_ENV + - name: Login to GitHub Container Registry + uses: docker/login-action@v1.14.1 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Login to DockerHub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - run: echo IMAGE_TAG=$(echo ${{ github.event.inputs.release_name != 'stable' && format('.{0}', github.event.inputs.release_name) || '' }}) >> $GITHUB_ENV + - name: Build and push Docker images + uses: docker/build-push-action@v2.9.0 + with: + context: . + file: Dockerfile + push: true + tags: | + ghcr.io/${{ env.IMAGE_OWNER }}/${{ env.IMAGE_NAME }}:${{ github.event.inputs.version }}${{ env.IMAGE_TAG }} + ${{ secrets.DOCKERHUB_USERNAME }}/${{ env.IMAGE_NAME }}:${{ github.event.inputs.version }}${{ env.IMAGE_TAG }} + build-args: | + GODOT_VERSION=${{ github.event.inputs.version }} + RELEASE_NAME=${{ github.event.inputs.release_name }} + SUBDIR=${{ github.event.inputs.release_name != 'stable' && format('/{0}', github.event.inputs.release_name) || '' }} + build-mono: + name: Build Mono Image + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v3 + - run: echo IMAGE_OWNER=$(echo ${{ github.repository_owner }} | tr '[:upper:]' '[:lower:]') >> $GITHUB_ENV + - name: Login to GitHub Container Registry + uses: docker/login-action@v1.14.1 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Login to DockerHub + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + - run: echo IMAGE_TAG=$(echo ${{ github.event.inputs.release_name != 'stable' && format('.{0}', github.event.inputs.release_name) || '' }}) >> $GITHUB_ENV + - name: Build and push Docker images + uses: docker/build-push-action@v2.9.0 + with: + context: . + file: mono.Dockerfile + push: true + tags: | + ghcr.io/${{ env.IMAGE_OWNER }}/${{ env.IMAGE_NAME }}:mono-${{ github.event.inputs.version }}${{ env.IMAGE_TAG }} + ${{ secrets.DOCKERHUB_USERNAME }}/${{ env.IMAGE_NAME }}:mono-${{ github.event.inputs.version }}${{ env.IMAGE_TAG }} + build-args: | + GODOT_VERSION=${{ github.event.inputs.version }} + RELEASE_NAME=${{ github.event.inputs.release_name }} + SUBDIR=${{ github.event.inputs.release_name != 'stable' && format('/{0}', github.event.inputs.release_name) || '' }} + diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c53fc13..ea70f0c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -48,6 +48,7 @@ jobs: ${{ secrets.DOCKERHUB_USERNAME }}/${{ env.IMAGE_NAME }}:${{ needs.version.outputs.version }} build-args: | GODOT_VERSION=${{ needs.version.outputs.version }} + RELEASE_NAME=${{ needs.version.outputs.release_name }} build-mono: name: Build Mono Image runs-on: ubuntu-20.04 diff --git a/Dockerfile b/Dockerfile index 58ce96d..b927da8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -18,18 +18,21 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ && rm -rf /var/lib/apt/lists/* ENV JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64 -ARG GODOT_VERSION="3.4.2" -RUN wget https://downloads.tuxfamily.org/godotengine/${GODOT_VERSION}/Godot_v${GODOT_VERSION}-stable_linux_headless.64.zip \ - && wget https://downloads.tuxfamily.org/godotengine/${GODOT_VERSION}/Godot_v${GODOT_VERSION}-stable_export_templates.tpz \ +ARG GODOT_VERSION="3.4.2" +ARG RELEASE_NAME="stable" +ARG SUBDIR="" + +RUN wget https://downloads.tuxfamily.org/godotengine/${GODOT_VERSION}${SUBDIR}/Godot_v${GODOT_VERSION}-${RELEASE_NAME}_linux_headless.64.zip \ + && wget https://downloads.tuxfamily.org/godotengine/${GODOT_VERSION}${SUBDIR}/Godot_v${GODOT_VERSION}-${RELEASE_NAME}_export_templates.tpz \ && mkdir ~/.cache \ && mkdir -p ~/.config/godot \ - && mkdir -p ~/.local/share/godot/templates/${GODOT_VERSION}.stable \ - && unzip Godot_v${GODOT_VERSION}-stable_linux_headless.64.zip \ - && mv Godot_v${GODOT_VERSION}-stable_linux_headless.64 /usr/local/bin/godot \ - && unzip Godot_v${GODOT_VERSION}-stable_export_templates.tpz \ - && mv templates/* ~/.local/share/godot/templates/${GODOT_VERSION}.stable \ - && rm -f Godot_v${GODOT_VERSION}-stable_export_templates.tpz Godot_v${GODOT_VERSION}-stable_linux_headless.64.zip + && mkdir -p ~/.local/share/godot/templates/${GODOT_VERSION}.${RELEASE_NAME} \ + && unzip Godot_v${GODOT_VERSION}-${RELEASE_NAME}_linux_headless.64.zip \ + && mv Godot_v${GODOT_VERSION}-${RELEASE_NAME}_linux_headless.64 /usr/local/bin/godot \ + && unzip Godot_v${GODOT_VERSION}-${RELEASE_NAME}_export_templates.tpz \ + && mv templates/* ~/.local/share/godot/templates/${GODOT_VERSION}.${RELEASE_NAME} \ + && rm -f Godot_v${GODOT_VERSION}-${RELEASE_NAME}_export_templates.tpz Godot_v${GODOT_VERSION}-${RELEASE_NAME}_linux_headless.64.zip ADD getbutler.sh /opt/butler/getbutler.sh RUN bash /opt/butler/getbutler.sh diff --git a/mono.Dockerfile b/mono.Dockerfile index 3163907..ebc3ea3 100644 --- a/mono.Dockerfile +++ b/mono.Dockerfile @@ -26,7 +26,7 @@ ARG RELEASE_NAME="stable" # This is only needed for non-stable builds (alpha, beta, RC) # e.g. SUBDIR "/beta3" # Use an empty string "" when the RELEASE_NAME is "stable" -ENV SUBDIR "" +ARG SUBDIR="" RUN wget https://downloads.tuxfamily.org/godotengine/${GODOT_VERSION}${SUBDIR}/mono/Godot_v${GODOT_VERSION}-${RELEASE_NAME}_mono_linux_headless_64.zip \ && wget https://downloads.tuxfamily.org/godotengine/${GODOT_VERSION}${SUBDIR}/mono/Godot_v${GODOT_VERSION}-${RELEASE_NAME}_mono_export_templates.tpz