Files
godot-ci/.github/workflows/manual_build.yml
2025-03-07 22:40:58 +01:00

106 lines
4.8 KiB
YAML

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:
version:
name: Get Version
runs-on: ubuntu-22.04
outputs:
dotnet_version: ${{ steps.calculate.outputs.dotnet_version }}
steps:
- id: calculate
run: |
MAJOR_VERSION=$(echo ${{ github.event.inputs.version }} | cut -c -1)
MINOR_VERSION=$(echo ${{ github.event.inputs.version }} | cut -c -3)
if [ "$MAJOR_VERSION" = "3" ]
then
echo "dotnet_version=mono:latest" >> $GITHUB_OUTPUT
elif [ "$MINOR_VERSION" = "4.0" ] || [ "$MINOR_VERSION" = "4.1" ] || [ "$MINOR_VERSION" = "4.2" ] || [ "$MINOR_VERSION" = "4.3" ]
then
echo "dotnet_version=mcr.microsoft.com/dotnet/sdk:6.0-jammy" >> $GITHUB_OUTPUT
else
echo "dotnet_version=mcr.microsoft.com/dotnet/sdk:8.0-jammy" >> $GITHUB_OUTPUT
fi
build:
name: Build Image
runs-on: ubuntu-22.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) || '' }}
GODOT_TEST_ARGS=${{ startsWith( github.event.inputs.version, '3.' ) && '' || '--headless --quit' }}
GODOT_PLATFORM=${{ startsWith( github.event.inputs.version, '3.' ) && 'linux_headless.64' || 'linux.x86_64' }}
build-mono:
name: Build Mono Image
runs-on: ubuntu-22.04
needs: [version]
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: |
IMAGE=${{ needs.version.outputs.dotnet_version }}
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) || '' }}
ZIP_GODOT_PLATFORM=${{ startsWith( github.event.inputs.version, '3.' ) && 'linux_headless_64' || 'linux_x86_64' }}
FILENAME_GODOT_PLATFORM=${{ startsWith( github.event.inputs.version, '3.' ) && 'linux_headless.64' || 'linux.x86_64' }}