All checks were successful
Coding Quality / Build and analyze (pull_request) Successful in 2m19s
160 lines
4.7 KiB
YAML
160 lines
4.7 KiB
YAML
name: Build Release
|
|
|
|
on:
|
|
push:
|
|
branches: [release]
|
|
pull_request:
|
|
branches: [release]
|
|
workflow_dispatch:
|
|
inputs:
|
|
dummy:
|
|
description: "Dry Run — tests the build process without creating a release"
|
|
required: false
|
|
|
|
env:
|
|
GODOT_VERSION: 4.6.1
|
|
EXPORT_NAME: Experements
|
|
PROJECT_PATH: .
|
|
BLENDER_VERSION: 5.0.0
|
|
|
|
jobs:
|
|
export:
|
|
name: ${{ matrix.name }} Export
|
|
runs-on: ubuntu-24.04
|
|
container: barichello/godot-ci:4.6
|
|
strategy:
|
|
matrix:
|
|
include:
|
|
- name: Windows
|
|
godot_preset: "Windows"
|
|
artifact_name: windows
|
|
output_ext: ".exe"
|
|
install_blender: true
|
|
- name: Linux
|
|
godot_preset: "Linux/X11"
|
|
artifact_name: linux
|
|
output_ext: ".x86_64"
|
|
install_blender: true
|
|
|
|
steps:
|
|
- name: Update and install dependencies
|
|
run: |
|
|
apt-get update
|
|
apt-get install -y curl gnupg
|
|
if [ "${{ matrix.install_blender }}" = "true" ]; then
|
|
apt-get install -y blender
|
|
fi
|
|
|
|
- name: Install Node.js
|
|
run: |
|
|
curl -fsSL https://deb.nodesource.com/setup_20.x | bash -
|
|
apt-get install -y nodejs
|
|
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
with:
|
|
lfs: true
|
|
|
|
- name: Setup
|
|
shell: bash
|
|
run: |
|
|
set -Eeuo pipefail
|
|
BLENDER_PATH="/usr/bin/blender"
|
|
mkdir -pv ~/.config/godot
|
|
mkdir -pv ~/.local/share/godot/export_templates/
|
|
GODOT_CFG="$(find ~/.config/godot -name "editor_settings-*.tres" | head -n 1 || true)"
|
|
|
|
if [ -z "$GODOT_CFG" ]; then
|
|
echo "# Missing Godot editor settings" > "$GODOT_CFG"
|
|
exit 1
|
|
fi
|
|
|
|
if [ -n "${BLENDER_PATH:-}" ]; then
|
|
if grep -q '^filesystem/import/blender/blender_path' "$GODOT_CFG"; then
|
|
sed -i "s|^filesystem/import/blender/blender_path = .*|filesystem/import/blender/blender_path = \"$BLENDER_PATH\"|" "$GODOT_CFG"
|
|
else
|
|
echo "filesystem/import/blender/blender_path = \"$BLENDER_PATH\"" >> "$GODOT_CFG"
|
|
fi
|
|
fi
|
|
echo "Blender path configured in $GODOT_CFG"
|
|
|
|
- name: Build
|
|
shell: bash
|
|
run: |
|
|
set -Eeuo pipefail
|
|
mkdir -v -p build/${{ matrix.artifact_name }}
|
|
EXPORT_DIR="$(readlink -f build)"
|
|
cd $PROJECT_PATH
|
|
godot --headless --export-release "${{ matrix.godot_preset }}" \
|
|
"$EXPORT_DIR/${{ matrix.artifact_name }}/$EXPORT_NAME${{ matrix.output_ext }}"
|
|
|
|
- name: Upload Artifact
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: ${{ matrix.artifact_name }}
|
|
path: build/${{ matrix.artifact_name }}
|
|
|
|
create-release:
|
|
name: Create Release
|
|
runs-on: ubuntu-latest
|
|
needs: [export]
|
|
if: github.event_name == 'push'
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Download Windows Artifact
|
|
uses: actions/download-artifact@v3
|
|
with:
|
|
name: windows
|
|
path: build/windows
|
|
|
|
- name: Download Linux Artifact
|
|
uses: actions/download-artifact@v3
|
|
with:
|
|
name: linux
|
|
path: build/linux
|
|
|
|
- name: Extract version and body from CHANGELOG
|
|
id: changelog
|
|
run: |
|
|
LATEST=$(grep -E '^## \[[0-9]+\.[0-9]+\.[0-9]+\]' CHANGELOG.md | head -n1 | sed -E 's/^## \[([0-9]+\.[0-9]+\.[0-9]+)\].*/\1/')
|
|
|
|
if [ -z "$LATEST" ]; then
|
|
echo "No released version found in CHANGELOG.md"
|
|
exit 1
|
|
fi
|
|
|
|
echo "Released version found: $LATEST"
|
|
echo "version=$LATEST" >> $GITHUB_OUTPUT
|
|
|
|
BODY=$(awk -v ver="$LATEST" '
|
|
$0 ~ "^## \\[" ver "\\]" {found=1; next}
|
|
found && $0 ~ "^## \\[" {exit}
|
|
found {print}
|
|
' CHANGELOG.md)
|
|
|
|
BODY=$(echo "$BODY" | sed '/^\s*$/d')
|
|
|
|
echo "body<<EOF" >> $GITHUB_OUTPUT
|
|
echo "$BODY" >> $GITHUB_OUTPUT
|
|
echo "EOF" >> $GITHUB_OUTPUT
|
|
|
|
- name: Zipping exports
|
|
run: |
|
|
zip -r windows-${{ steps.changelog.outputs.version }}.zip build/windows
|
|
zip -r linux-${{ steps.changelog.outputs.version }}.zip build/linux
|
|
|
|
- name: Create Release
|
|
uses: akkuman/gitea-release-action@v1
|
|
with:
|
|
server_url: ${{ vars.SERVER_URL }}
|
|
tag_name: ${{ steps.changelog.outputs.version }}
|
|
name: "${{ steps.changelog.outputs.version }}"
|
|
body: ${{ steps.changelog.outputs.body }}
|
|
draft: false
|
|
token: ${{ secrets.GITEA_TOKEN }}
|
|
files: |
|
|
windows-${{ steps.changelog.outputs.version }}.zip
|
|
linux-${{ steps.changelog.outputs.version }}.zip
|