90 lines
2.7 KiB
YAML
90 lines
2.7 KiB
YAML
name: Build Release
|
|
|
|
on:
|
|
push:
|
|
branches: [release]
|
|
pull_request:
|
|
branches: [release]
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
preset: ["Windows", "Linux/X11", "Web"]
|
|
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
|
|
- 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
|
|
|
|
# Create Release also creates an Tag
|
|
# - name: Create git tag
|
|
# uses: alazhar/gitea-action-autotag@v1
|
|
# with:
|
|
# tag: ${{ steps.changelog.outputs.version }}
|
|
|
|
- name: Build
|
|
id: build
|
|
uses: mlm-games/godot-build-action@v1.3.1
|
|
with:
|
|
EXPORT_PRESET_NAME: ${{ matrix.preset }}
|
|
INSTALL_BLENDER: "true"
|
|
BLENDER_VERSION: "5.0.0"
|
|
VERBOSE_IMPORT: "false"
|
|
|
|
- name: Normalize build path
|
|
id: normalize
|
|
run: |
|
|
# Assuming your build outputs are in build/<platform>/
|
|
PLATFORM_PATH="build/${{ matrix.preset }}"
|
|
if [ ! -d "$PLATFORM_PATH" ]; then
|
|
echo "Build folder not found for ${{ matrix.preset }}"
|
|
exit 1
|
|
fi
|
|
echo "path=$PLATFORM_PATH" >> $GITHUB_OUTPUT
|
|
|
|
- name: Upload builds
|
|
uses: actions/upload-artifact@v5
|
|
with:
|
|
name: godot-${{ matrix.preset }}-v${{ steps.changelog.outputs.version }}
|
|
path: ${{ steps.normalize.outputs.path }}
|
|
|
|
- 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 }}
|