Files
Godot-Experements/.gitea/workflows/release.yml
2026-03-17 22:54:31 +01:00

134 lines
3.7 KiB
YAML

name: Build Release
on:
push:
branches: [release]
pull_request:
branches: [release]
env:
GODOT_VERSION: 4.6.1
EXPORT_NAME: Experements
PROJECT_PATH: .
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
run: |
mkdir -v -p ~/.local/share/godot/export_templates/
mkdir -v -p ~/.config/
- name: Windows Build
run: |
mkdir -v -p build/windows
EXPORT_DIR="$(readlink -f build)"
cd $PROJECT_PATH
godot --headless --verbose --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: |
mkdir -v -p build/linux
EXPORT_DIR="$(readlink -f build)"
cd $PROJECT_PATH
godot --headless --verbose --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 }}