157 lines
5.0 KiB
YAML
157 lines
5.0 KiB
YAML
name: Build Release
|
|
|
|
on:
|
|
push:
|
|
branches: [release]
|
|
pull_request:
|
|
branches: [release]
|
|
|
|
env:
|
|
GODOT_VERSION: 4.6.1
|
|
EXPORT_NAME: Experements
|
|
PROJECT_PATH: .
|
|
BLENDER_VERSION: 5.0.0
|
|
|
|
jobs:
|
|
export-windows:
|
|
name: Windows Export
|
|
runs-on: ubuntu-24.04 # Use 24.04 with godot 4
|
|
container: barichello/godot-ci:4.6
|
|
steps:
|
|
- name: Update and install dependencies
|
|
run: |
|
|
apt-get update
|
|
apt-get install -y curl gnupg
|
|
|
|
- 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: |
|
|
mkdir -v -p ~/.local/share/godot/export_templates/
|
|
mkdir -v -p ~/.config/
|
|
set -Eeuo pipefail
|
|
echo "Installing Blender ${{ env.BLENDER_VERSION }}..."
|
|
MAJOR_MINOR="$(echo "${{ env.BLENDER_VERSION }}" | cut -d. -f1,2)"
|
|
BLENDER_URL="https://download.blender.org/release/Blender${MAJOR_MINOR}/blender-${{ env.BLENDER_VERSION }}-linux-x64.tar.xz"
|
|
wget -q "$BLENDER_URL" -O ~/blender.tar.xz
|
|
tar -xf ~/blender.tar.xz -C ~/
|
|
BLENDER_DIR="$(find ~ -maxdepth 1 -name "blender-*" -type d | head -n 1)"
|
|
echo "${BLENDER_DIR}" >> "$GITHUB_PATH"
|
|
echo "BLENDER_PATH=${BLENDER_DIR}/blender" >> "$GITHUB_ENV"
|
|
"${BLENDER_DIR}/blender" --version
|
|
|
|
GODOT_CFG="$(find ~/.config/godot -name "editor_settings-*.tres" | head -n 1 || true)"
|
|
if [ -n "$GODOT_CFG" ]; then
|
|
if [ -n "${BLENDER_PATH:-}" ]; then
|
|
grep -q '^filesystem/import/blender/blender_path' "$GODOT_CFG" \
|
|
&& sed -i "s|^filesystem/import/blender/blender_path = .*|filesystem/import/blender/blender_path = \"$BLENDER_PATH\"|" "$GODOT_CFG" \
|
|
|| echo "filesystem/import/blender/blender_path = \"$BLENDER_PATH\"" >> "$GODOT_CFG"
|
|
fi
|
|
fi
|
|
|
|
- name: Windows Build
|
|
run: |
|
|
set -Eeuo pipefail
|
|
mkdir -v -p build/windows
|
|
EXPORT_DIR="$(readlink -f build)"
|
|
cd $PROJECT_PATH
|
|
godot --headless --export-release "Windows" "$EXPORT_DIR/windows/$EXPORT_NAME.exe"
|
|
- name: Upload Artifact
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: windows
|
|
path: build/windows
|
|
|
|
# export-linux:
|
|
# name: Linux Export
|
|
# runs-on: ubuntu-24.04 # Use 24.04 with godot 4
|
|
# container: barichello/godot-ci:4.6
|
|
# steps:
|
|
# - name: Update and install dependencies
|
|
# run: |
|
|
# apt-get update
|
|
# apt-get install -y curl gnupg
|
|
|
|
# - 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
|
|
# run: |
|
|
# mkdir -v -p ~/.local/share/godot/export_templates/
|
|
|
|
# - name: Linux Build
|
|
# run: |
|
|
# set -Eeuo pipefail
|
|
# mkdir -v -p build/linux
|
|
# EXPORT_DIR="$(readlink -f build)"
|
|
# cd $PROJECT_PATH
|
|
# godot --headless --export-release "Linux/X11" "$EXPORT_DIR/linux/$EXPORT_NAME.x86_64"
|
|
|
|
# - name: Upload Artifact
|
|
# uses: actions/upload-artifact@v3
|
|
# with:
|
|
# name: linux
|
|
# path: build/linux
|
|
|
|
create-release:
|
|
name: Create Release
|
|
runs-on: ubuntu-latest
|
|
needs: [export-linux, export-windows]
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Extract version and body from CHANGELOG
|
|
id: changelog
|
|
run: |
|
|
# Extract the latest released version (skip Unreleased)
|
|
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
|
|
|
|
# Extract the body: lines until the next ## header
|
|
BODY=$(awk -v ver="$LATEST" '
|
|
$0 ~ "^## \\[" ver "\\]" {found=1; next}
|
|
found && $0 ~ "^## \\[" {exit}
|
|
found {print}
|
|
' CHANGELOG.md)
|
|
|
|
# Trim leading/trailing empty lines
|
|
BODY=$(echo "$BODY" | sed '/^\s*$/d')
|
|
|
|
# Output body safely for GitHub Actions
|
|
echo "body<<EOF" >> $GITHUB_OUTPUT
|
|
echo "$BODY" >> $GITHUB_OUTPUT
|
|
echo "EOF" >> $GITHUB_OUTPUT
|
|
|
|
- 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 }}
|