157 lines
6.3 KiB
YAML
157 lines
6.3 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
|
|
set_latest:
|
|
description: 'Tag as latest'
|
|
type: boolean
|
|
default: false
|
|
env:
|
|
IMAGE_NAME: godot-ci
|
|
jobs:
|
|
version:
|
|
name: Get Version
|
|
runs-on: ubuntu-24.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
|
|
get_tags:
|
|
name: Get Tags
|
|
runs-on: ubuntu-24.04
|
|
outputs:
|
|
tags: ${{steps.write_tags.outputs.tags}}
|
|
tags_mono: ${{steps.write_tags_mono.outputs.tags}}
|
|
steps:
|
|
- run: echo IMAGE_OWNER=$(echo ${{ github.repository_owner }} | tr '[:upper:]' '[:lower:]') >> $GITHUB_ENV
|
|
- run: echo IMAGE_TAG=$(echo ${{ github.event.inputs.release_name != 'stable' && format('.{0}', github.event.inputs.release_name) || '' }}) >> $GITHUB_ENV
|
|
- name: Set tags
|
|
run: |
|
|
echo "ghcr.io/${{ env.IMAGE_OWNER }}/${{ env.IMAGE_NAME }}:${{ github.event.inputs.version }}${{ env.IMAGE_TAG }}" >> tags.txt
|
|
echo "${{ secrets.DOCKERHUB_USERNAME }}/${{ env.IMAGE_NAME }}:${{ github.event.inputs.version }}${{ env.IMAGE_TAG }}" >> tags.txt
|
|
- name: Set latest tags
|
|
if: ${{inputs.set_latest}}
|
|
run: |
|
|
echo "ghcr.io/${{ env.IMAGE_OWNER }}/${{ env.IMAGE_NAME }}:latest" >> tags.txt
|
|
echo "${{ secrets.DOCKERHUB_USERNAME }}/${{ env.IMAGE_NAME }}:latest" >> tags.txt
|
|
- name: Set Mono tags
|
|
run: |
|
|
echo "ghcr.io/${{ env.IMAGE_OWNER }}/${{ env.IMAGE_NAME }}:mono-${{ github.event.inputs.version }}${{ env.IMAGE_TAG }}" >> tags_mono.txt
|
|
echo "${{ secrets.DOCKERHUB_USERNAME }}/${{ env.IMAGE_NAME }}:mono-${{ github.event.inputs.version }}${{ env.IMAGE_TAG }}" >> tags_mono.txt
|
|
- name: Set Mono latest tags
|
|
if: ${{inputs.set_latest}}
|
|
run: |
|
|
echo "ghcr.io/${{ env.IMAGE_OWNER }}/${{ env.IMAGE_NAME }}:mono-latest" >> tags_mono.txt
|
|
echo "${{ secrets.DOCKERHUB_USERNAME }}/${{ env.IMAGE_NAME }}:mono-latest" >> tags_mono.txt
|
|
- uses: actions/upload-artifact@v4
|
|
with:
|
|
name: image_tags
|
|
path: tags.txt
|
|
retention-days: 1
|
|
- uses: actions/upload-artifact@v4
|
|
with:
|
|
name: image_tags_mono
|
|
path: tags_mono.txt
|
|
retention-days: 1
|
|
build:
|
|
name: Build Image
|
|
runs-on: ubuntu-24.04
|
|
needs: get_tags
|
|
steps:
|
|
- uses: actions/download-artifact@v4
|
|
with:
|
|
name: image_tags
|
|
- run: |
|
|
{
|
|
echo 'TAGS<<EOF'
|
|
cat tags.txt
|
|
echo EOF
|
|
} >> "$GITHUB_ENV"
|
|
- uses: actions/checkout@v3
|
|
- 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 }}
|
|
- name: Build and push Docker images
|
|
uses: docker/build-push-action@v2.9.0
|
|
with:
|
|
context: .
|
|
file: Dockerfile
|
|
push: true
|
|
tags: ${{ env.TAGS }}
|
|
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-24.04
|
|
needs: [version, get_tags]
|
|
steps:
|
|
- uses: actions/download-artifact@v4
|
|
with:
|
|
name: image_tags_mono
|
|
- run: |
|
|
{
|
|
echo 'TAGS<<EOF'
|
|
cat tags_mono.txt
|
|
echo EOF
|
|
} >> "$GITHUB_ENV"
|
|
- uses: actions/checkout@v3
|
|
- 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 }}
|
|
- name: Build and push Docker images
|
|
uses: docker/build-push-action@v2.9.0
|
|
with:
|
|
context: .
|
|
file: mono.Dockerfile
|
|
push: true
|
|
tags: ${{ env.TAGS }}
|
|
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' }}
|
|
|